data_source stringclasses 1 value | prompt listlengths 2 2 | ability stringclasses 1 value | reward_model dict | extra_info dict |
|---|---|---|---|---|
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['S', 'J', 'Lee']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductLine text, -- example: ['S', 'R']\n Class text, -- example: ['L', 'M']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncurrency pair refers to FromCurrencyCode/ToCurrencyCode\nWhich currency pair's average exchange rate for the day is the highest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT FromCurrencyCode, ToCurrencyCode FROM CurrencyRate ORDER BY AverageRate DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT FromCurrencyCode, ToCurrencyCode FROM CurrencyRate ORDER BY AverageRate DESC LIMIT 1",
"index": 3300,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['S', 'J', 'Lee']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductLine text, -- example: ['S', 'R']\n Class text, -- example: ['L', 'M']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncurrency pair refers to FromCurrencyCode/ToCurrencyCode\nWhich currency pair's average exchange rate for the day is the highest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of products refers to OrderQty\nHow many products with the highest unit price were ordered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1",
"index": 3301,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of products refers to OrderQty\nHow many products with the highest unit price were ordered?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['US', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['US', 'AD', 'AE']\n Name text, -- example: ['United States', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Southeast', 'Northwest', 'Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n StandardCost real, -- example: [0.0, 98.77]\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['US', 'FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUnited States refers to CountryRegionCode = 'US';\nBetween Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1",
"index": 3302,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['US', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['US', 'AD', 'AE']\n Name text, -- example: ['United States', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Southeast', 'Northwest', 'Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n StandardCost real, -- example: [0.0, 98.77]\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['US', 'FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUnited States refers to CountryRegionCode = 'US';\nBetween Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to Rating = 1;\nWhat are the names of the product that has the lowest rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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 )",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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 )",
"index": 3303,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to Rating = 1;\nWhat are the names of the product that has the lowest rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-01', '2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Production', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nStartDate BETWEEN '2009-01-01' AND '2009-12-31';\nHow many of the workers who started working in 2009 are from the Production Department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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'",
"index": 3304,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-01', '2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Production', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nStartDate BETWEEN '2009-01-01' AND '2009-12-31';\nHow many of the workers who started working in 2009 are from the Production Department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['F', 'M']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Max', 'Ken', 'Terri']\n MiddleName text, -- example: ['F', 'S', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['S', 'W']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = FirstName+MiddleName+LastName; highest-paid refers to max(Rate); single refers to Status = 'S'; female refers to Gender = 'F';\nWho is the company's highest-paid single female employee? Include her full name and job title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3305,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['F', 'M']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Max', 'Ken', 'Terri']\n MiddleName text, -- example: ['F', 'S', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['S', 'W']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = FirstName+MiddleName+LastName; highest-paid refers to max(Rate); single refers to Status = 'S'; female refers to Gender = 'F';\nWho is the company's highest-paid single female employee? Include her full name and job title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['He', 'Sánchez', 'Duffy']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Engineering', 'Document Control']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['he', 'en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['he', 'ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['58', 'M']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Vice President of Engineering', 'Chief Executive Officer']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = FirstName+MiddleName+LastName; HiredDate refers to the date the person joins the company;\nWho is the Vice President of Engineering and when did he join the company? Indicate his/her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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'",
"index": 3306,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['He', 'Sánchez', 'Duffy']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Engineering', 'Document Control']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['he', 'en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['he', 'ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['58', 'M']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Vice President of Engineering', 'Chief Executive Officer']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name = FirstName+MiddleName+LastName; HiredDate refers to the date the person joins the company;\nWho is the Vice President of Engineering and when did he join the company? Indicate his/her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipToAddressID integer, -- example: [985, 921]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n ChangeNumber integer, -- example: [0, 28]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast number of sick leave refers to min(SickLeaveHours); PayFrequency = 1 means ‘Salary received monthly’; PayFrequency = 2 means ‘Salary received biweekly';\nHow frequently do the employee with the least number of sick leave hours get paid?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1",
"index": 3307,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipToAddressID integer, -- example: [985, 921]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n ChangeNumber integer, -- example: [0, 28]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast number of sick leave refers to min(SickLeaveHours); PayFrequency = 1 means ‘Salary received monthly’; PayFrequency = 2 means ‘Salary received biweekly';\nHow frequently do the employee with the least number of sick leave hours get paid?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Finance', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n Class text, -- example: ['L', 'M']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the total number of employees that worked in the Finance department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (DepartmentID) WHERE T1.Name = 'Finance'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (DepartmentID) WHERE T1.Name = 'Finance'",
"index": 3308,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Finance', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n Class text, -- example: ['L', 'M']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the total number of employees that worked in the Finance department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Components', 'Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofit = subtract(ListPrice, StandardCost); the depth the component from its parent refers to BOMLevel;\nWhat 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.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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 )",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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 )",
"index": 3309,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Components', 'Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprofit = subtract(ListPrice, StandardCost); the depth the component from its parent refers to BOMLevel;\nWhat 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.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MinQty integer, -- Min Quality, example: [0, 11]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct maintenance documents are private refers to DocumentSummary = null\nHow many product maintenance documents are private?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL",
"index": 3310,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MinQty integer, -- Min Quality, example: [0, 11]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct maintenance documents are private refers to DocumentSummary = null\nHow many product maintenance documents are private?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndocument has been approved refers to Status = 2\nPlease list the job titles of the employees who has a document that has been approved.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.BusinessEntityID, T2.JobTitle FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 2",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT DISTINCT T2.BusinessEntityID, T2.JobTitle FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 2",
"index": 3311,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndocument has been approved refers to Status = 2\nPlease list the job titles of the employees who has a document that has been approved.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Min', 'Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noldest employee refers to min(BirthDate); PayFrequency = 1 refers to ‘Salary received monthly’; PayFrequency = 2 refers to ‘Salary received biweekly'\nWhat is the pay frequency of the oldest employee?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.PayFrequency FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.BirthDate ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.PayFrequency FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.BirthDate ASC LIMIT 1",
"index": 3312,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Min', 'Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noldest employee refers to min(BirthDate); PayFrequency = 1 refers to ‘Salary received monthly’; PayFrequency = 2 refers to ‘Salary received biweekly'\nWhat is the pay frequency of the oldest employee?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['M', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarried refers to MaritalStatus = M; highest pay frequency refers to PayFrequency = 2\nAmong the employees whose pay frequencies are the highest, how many of them are married?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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 )",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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 )",
"index": 3313,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['M', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarried refers to MaritalStatus = M; highest pay frequency refers to PayFrequency = 2\nAmong the employees whose pay frequencies are the highest, how many of them are married?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['M', '58']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status of employees refers to CurrentFlag = 1; Male refers to Gender = 'M'; highest frequency refers to PayFrequency = 2;\nAmong the active male employees, how many of them are paid with the highest frequency?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3314,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['M', '58']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status of employees refers to CurrentFlag = 1; Male refers to Gender = 'M'; highest frequency refers to PayFrequency = 2;\nAmong the active male employees, how many of them are paid with the highest frequency?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n MiddleName text, -- example: ['M', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n TerritoryID integer, -- example: [5, 6]\n ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['M', '58']\n SizeUnitMeasureCode text, -- example: ['CM']\n Style text, -- example: ['M', 'U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarried refers to MaritalStatus = 'M'; western name style refers to NameStyle = '0';\nAmong the employees who are married, how many of them have a western name style?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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'",
"index": 3315,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n MiddleName text, -- example: ['M', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n TerritoryID integer, -- example: [5, 6]\n ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['M', '58']\n SizeUnitMeasureCode text, -- example: ['CM']\n Style text, -- example: ['M', 'U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarried refers to MaritalStatus = 'M'; western name style refers to NameStyle = '0';\nAmong the employees who are married, how many of them have a western name style?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nContact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 20 vacations hours refers to VacationHours>20\nPlease list the employees who have more than 20 vacations hours and wish to receive e-mail promotions.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3316,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nContact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 20 vacations hours refers to VacationHours>20\nPlease list the employees who have more than 20 vacations hours and wish to receive e-mail promotions.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n City text, -- example: ['Ottawa', 'Burnaby']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['JOD', 'AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['SP', 'EM']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Max', 'Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['JOD', 'AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales person refers to PersonType = 'SP'; oldest employee refers to Max (Subtract((now())-BirthDate));\nPlease give the additional contact information of the oldest employee with the jod position of sales person.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3317,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n City text, -- example: ['Ottawa', 'Burnaby']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['JOD', 'AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['SP', 'EM']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Max', 'Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['JOD', 'AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales person refers to PersonType = 'SP'; oldest employee refers to Max (Subtract((now())-BirthDate));\nPlease give the additional contact information of the oldest employee with the jod position of sales person.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['MR', 'AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status of employees refers to CurrentFlag = 1;\nAmong the active employees, how many of them have a courtesy title of \"Mr\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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.'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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.'",
"index": 3318,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['MR', 'AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status of employees refers to CurrentFlag = 1;\nAmong the active employees, how many of them have a courtesy title of \"Mr\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['SC', 'EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['SC', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore contact refers to PersonType = 'SC';\nWhat is the surname suffix of the employee who works as a store contact and has the longest sick leave hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3319,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['SC', 'EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['SC', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore contact refers to PersonType = 'SC';\nWhat is the surname suffix of the employee who works as a store contact and has the longest sick leave hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status of employees refers to CurrentFlag = 1; the employee does not wish to receive an e-mail promotion refers to EmailPromotion = 0;\nHow many active employees do not wish to receive e-mail promotions?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3320,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status of employees refers to CurrentFlag = 1; the employee does not wish to receive an e-mail promotion refers to EmailPromotion = 0;\nHow many active employees do not wish to receive e-mail promotions?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n TerritoryID integer, -- example: [5, 6]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee refers to PersonType = 'EM'; Male refers to Gender = 'M'; Average = Divide( SUM(VacationHours(PersonType = 'EM'& Gender = 'M')),Count(BusinessEntityID(PersonType = 'EM' & Gender = 'M')));\nHow many vacation hours do the male employees have on average?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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'",
"index": 3321,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n TerritoryID integer, -- example: [5, 6]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee refers to PersonType = 'EM'; Male refers to Gender = 'M'; Average = Divide( SUM(VacationHours(PersonType = 'EM'& Gender = 'M')),Count(BusinessEntityID(PersonType = 'EM' & Gender = 'M')));\nHow many vacation hours do the male employees have on average?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['E', 'M', 'A', 'B']\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n `Comment` text,\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['M', 'L']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarried refers to MaritalStatus = 'M'; Contact does wish to receive e-mail promotions from Adventure Works refers to EmailPromotion = 1; Average = Divide (Sum(Rate (MaritalStatus = 'M' & EmailPromotion = 1))), Count (BusinessEntityID (MaritalStatus = 'M' & EmailPromotion = 1)); MAX(Rate (MaritalStatus = 'M' & EmailPromotion = 1) - Average;\nAmong 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?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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'",
"index": 3322,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['E', 'M', 'A', 'B']\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n `Comment` text,\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['M', 'L']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarried refers to MaritalStatus = 'M'; Contact does wish to receive e-mail promotions from Adventure Works refers to EmailPromotion = 1; Average = Divide (Sum(Rate (MaritalStatus = 'M' & EmailPromotion = 1))), Count (BusinessEntityID (MaritalStatus = 'M' & EmailPromotion = 1)); MAX(Rate (MaritalStatus = 'M' & EmailPromotion = 1) - Average;\nAmong 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?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Percentage', 'Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCurrentFlag = 1 refers to the active status of employees; Percentage = Divide (Count (BusinessEntityID (CurrentFlag = 1 & VacationHours >20 & SickLeaveHours > 10)), Count (BusinessEntityID (CurrentFlag = 1 & SickLeaveHours>10))) * 100;\nAmong the active employees with over 10 hours of sick leave, what is the percentage of the employees with over 20 vacation hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3323,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Percentage', 'Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCurrentFlag = 1 refers to the active status of employees; Percentage = Divide (Count (BusinessEntityID (CurrentFlag = 1 & VacationHours >20 & SickLeaveHours > 10)), Count (BusinessEntityID (CurrentFlag = 1 & SickLeaveHours>10))) * 100;\nAmong the active employees with over 10 hours of sick leave, what is the percentage of the employees with over 20 vacation hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n ProductLine text, -- example: ['R', 'S']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE(SUM(lastreceiptcost), COUNT(OnorderQty)) where AverageLeadTime = 60\nAverage of the last receipt cost of the products whose average lead time is 60 days.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(LastReceiptCost) / COUNT(ProductID) FROM ProductVendor WHERE AverageLeadTime = 60",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT SUM(LastReceiptCost) / COUNT(ProductID) FROM ProductVendor WHERE AverageLeadTime = 60",
"index": 3324,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n ProductLine text, -- example: ['R', 'S']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = DIVIDE(SUM(lastreceiptcost), COUNT(OnorderQty)) where AverageLeadTime = 60\nAverage of the last receipt cost of the products whose average lead time is 60 days.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to Gender = 'M'; hired throughout the years 2009 refers to Year(HireDate) = 2009; married refers to MaritalStatus = 'M'; percentage = DIVIDE(count(BusinessEntityID(Gender = 'M'& Year(HireDate) = '2009& MaritalStatus = 'M')), count(BusinessEntityID(Gender = 'M'& Year(HireDate) = 2009)))\n\n\nWhat percentage of male employees hired throughout the years 2009 are married?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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'",
"index": 3325,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to Gender = 'M'; hired throughout the years 2009 refers to Year(HireDate) = 2009; married refers to MaritalStatus = 'M'; percentage = DIVIDE(count(BusinessEntityID(Gender = 'M'& Year(HireDate) = '2009& MaritalStatus = 'M')), count(BusinessEntityID(Gender = 'M'& Year(HireDate) = 2009)))\n\n\nWhat percentage of male employees hired throughout the years 2009 are married?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TotalDue real, -- example: [23153.2339, 1457.3288]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\napproved refers to Status = 2 , average total due price = AVG( DIVIDE(TotalDue, SUM(Status = 2 )))\nWhat is the average total due price of products with approved status?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(TotalDue) / COUNT(TotalDue) FROM PurchaseOrderHeader WHERE Status = 2",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT SUM(TotalDue) / COUNT(TotalDue) FROM PurchaseOrderHeader WHERE Status = 2",
"index": 3326,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TotalDue real, -- example: [23153.2339, 1457.3288]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\napproved refers to Status = 2 , average total due price = AVG( DIVIDE(TotalDue, SUM(Status = 2 )))\nWhat is the average total due price of products with approved status?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ReorderPoint integer, -- example: [750, 600]\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Percentage', 'Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquantities not greater than 3 refers to OrderQty<3; discount of 0.2 refers to UnitPriceDiscount = 0.2; percentage = DIVIDE(count(SalesOrderID(OrderQty<3 & UnitPriceDiscount = 0.2)), count(SalesOrderID))*100%\nWhat is the percentage, by number of sales order units, for orders with quantities not greater than 3 and a discount of 0.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail",
"index": 3327,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ReorderPoint integer, -- example: [750, 600]\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Percentage', 'Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nquantities not greater than 3 refers to OrderQty<3; discount of 0.2 refers to UnitPriceDiscount = 0.2; percentage = DIVIDE(count(SalesOrderID(OrderQty<3 & UnitPriceDiscount = 0.2)), count(SalesOrderID))*100%\nWhat is the percentage, by number of sales order units, for orders with quantities not greater than 3 and a discount of 0.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n SalesPersonID integer, -- example: [279, 282]\n ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n SalariedFlag integer, -- example: [1, 0]\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n ProductLine text, -- example: ['S', 'R']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nincreased their current year sales by more than 60% refers to\nDIVIDE(SUBTRACT(SalesYTD, SalesLastYear),SalesLastYear)>0.6\nLists 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.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000",
"index": 3328,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n SalesPersonID integer, -- example: [279, 282]\n ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n SalariedFlag integer, -- example: [1, 0]\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n ProductLine text, -- example: ['S', 'R']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nincreased their current year sales by more than 60% refers to\nDIVIDE(SUBTRACT(SalesYTD, SalesLastYear),SalesLastYear)>0.6\nLists 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.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n BillToAddressID integer, -- example: [985, 921]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2011-08-18 00:00:00.0', '2011-08-17 00:00:00.0', '2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptDate datetime, -- example: ['2011-08-18 00:00:00.0', '2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlast receipt date is August 17, 2011 refers to LastReceiptDate> = '2011-08-17 00:00:00' and LastReceiptDate < '2011-08-18 00:00:00';\nWhat 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?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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'",
"index": 3329,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n BillToAddressID integer, -- example: [985, 921]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2011-08-18 00:00:00.0', '2011-08-17 00:00:00.0', '2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptDate datetime, -- example: ['2011-08-18 00:00:00.0', '2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlast receipt date is August 17, 2011 refers to LastReceiptDate> = '2011-08-17 00:00:00' and LastReceiptDate < '2011-08-18 00:00:00';\nWhat 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?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Components', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalculate the number of products if we add the products of the accessories and components categories.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(ProductID) FROM Product WHERE Name LIKE '%accessories %' OR Name LIKE '%components%'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(ProductID) FROM Product WHERE Name LIKE '%accessories %' OR Name LIKE '%components%'",
"index": 3330,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Components', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCalculate the number of products if we add the products of the accessories and components categories.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Production', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Male', 'Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n StateProvinceID integer, -- example: [57, 7]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunmarried refers to MaritalStatus = 'S', male refers to Gender = 'M', Production Supervisors is a job title\nList the first and last name of all unmarried male Production Supervisors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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%'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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%'",
"index": 3331,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Production', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Male', 'Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n StateProvinceID integer, -- example: [57, 7]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n ProductSubcategoryID integer, -- example: [14, 31]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nunmarried refers to MaritalStatus = 'S', male refers to Gender = 'M', Production Supervisors is a job title\nList the first and last name of all unmarried male Production Supervisors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Yellow', 'Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n MiddleName text, -- example: ['J', 'Lee']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyellow product refers to Color = 'Yellow'; minimum inventory stock of 500 units refers to SafetyStockLevel = 500\nWhat type of transaction was made with the only yellow product, size 62 and with a minimum inventory stock of 500 units?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "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",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "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",
"index": 3332,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Yellow', 'Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n MiddleName text, -- example: ['J', 'Lee']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyellow product refers to Color = 'Yellow'; minimum inventory stock of 500 units refers to SafetyStockLevel = 500\nWhat type of transaction was made with the only yellow product, size 62 and with a minimum inventory stock of 500 units?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['G', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['G', 'J', 'Lee']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin grams refers to WeightUnitMeasureCode = 'G'\nWhat is the product cost end date with the highest weight in grams?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.EndDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WeightUnitMeasureCode = 'G' ORDER BY T1.Weight DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.EndDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WeightUnitMeasureCode = 'G' ORDER BY T1.Weight DESC LIMIT 1",
"index": 3333,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['G', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['G', 'J', 'Lee']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin grams refers to WeightUnitMeasureCode = 'G'\nWhat is the product cost end date with the highest weight in grams?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Shipping', 'Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FileName text, -- example: ['Documents', 'Overview']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipping method was Cargo Transport 5 refers to Name = 'Cargo Transport 5'; average = DIVIDE(SUM(OrderQty where Name = 'Cargo Transport 5'), COUNT(ShipMethodID))\nCalculate the average of the total ordered quantity of products purchased whose shipping method was Cargo Transport 5.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T1.ShipMethodID = 5, T3.OrderQty, 0)) AS REAL) / COUNT(T3.ProductID) FROM ShipMethod AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.ShipMethodID = T2.ShipMethodID INNER JOIN PurchaseOrderDetail AS T3 ON T2.PurchaseOrderID = T3.PurchaseOrderID",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T1.ShipMethodID = 5, T3.OrderQty, 0)) AS REAL) / COUNT(T3.ProductID) FROM ShipMethod AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.ShipMethodID = T2.ShipMethodID INNER JOIN PurchaseOrderDetail AS T3 ON T2.PurchaseOrderID = T3.PurchaseOrderID",
"index": 3334,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Shipping', 'Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FileName text, -- example: ['Documents', 'Overview']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipping method was Cargo Transport 5 refers to Name = 'Cargo Transport 5'; average = DIVIDE(SUM(OrderQty where Name = 'Cargo Transport 5'), COUNT(ShipMethodID))\nCalculate the average of the total ordered quantity of products purchased whose shipping method was Cargo Transport 5.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n Freight real, -- example: [616.0984, 38.8276]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee refers to BusinessEntityID; salaries on a monthly basis refers to PayFrequency = 1; hourly rate more than 50 refers to Rate > 50\nHow many employees earn their salaries on a monthly basis at an hourly rate of more than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(BusinessEntityID) FROM EmployeePayHistory WHERE rate * PayFrequency > 50",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(BusinessEntityID) FROM EmployeePayHistory WHERE rate * PayFrequency > 50",
"index": 3335,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n Freight real, -- example: [616.0984, 38.8276]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee refers to BusinessEntityID; salaries on a monthly basis refers to PayFrequency = 1; hourly rate more than 50 refers to Rate > 50\nHow many employees earn their salaries on a monthly basis at an hourly rate of more than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['S', 'P']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['S', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Size text, -- example: ['S', '58', 'M']\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Revision text, -- example: ['0', '4']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n SalesPersonID integer, -- example: [279, 282]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompany number 1 refers to BusinessEntityId = 1; employee refers to PersonType = 'EM'; full name refers to FirstName + MiddleName + LastName\nWhat is the employee of company number 1's full name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'",
"index": 3336,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['S', 'P']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['S', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Size text, -- example: ['S', '58', 'M']\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Revision text, -- example: ['0', '4']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n SalesPersonID integer, -- example: [279, 282]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompany number 1 refers to BusinessEntityId = 1; employee refers to PersonType = 'EM'; full name refers to FirstName + MiddleName + LastName\nWhat is the employee of company number 1's full name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupplier number 1492 refers to BusinessEntityId = 1492; name of the supplier = name from vendor\nWhat is the name of the supplier number 1492?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492",
"index": 3337,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupplier number 1492 refers to BusinessEntityId = 1492; name of the supplier = name from vendor\nWhat is the name of the supplier number 1492?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['C', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['C.', 'C', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['C', 'A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfamily names refers to Last name; employee refers to PersonType = 'EM'; MiddleName starts with 'C'\nPlease list the family names of any employees whose middle names begin with C.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT LastName FROM Person WHERE PersonType = 'EM' AND MiddleName LIKE 'C%'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT LastName FROM Person WHERE PersonType = 'EM' AND MiddleName LIKE 'C%'",
"index": 3338,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['C', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['C.', 'C', 'J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['C', 'A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfamily names refers to Last name; employee refers to PersonType = 'EM'; MiddleName starts with 'C'\nPlease list the family names of any employees whose middle names begin with C.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n BillToAddressID integer, -- example: [985, 921]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct number = productID\nPlease list any 3 product numbers with the lowest standard cost.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3",
"index": 3339,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n BillToAddressID integer, -- example: [985, 921]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct number = productID\nPlease list any 3 product numbers with the lowest standard cost.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductSubcategoryID integer, -- example: [14, 31]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddress number refers to AddressID; full address refers to AddressLine1 + AddressLine2\nWhat is the full address of address number 11906?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID = 11906",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID = 11906",
"index": 3340,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductSubcategoryID integer, -- example: [14, 31]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddress number refers to AddressID; full address refers to AddressLine1 + AddressLine2\nWhat is the full address of address number 11906?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers' name refers to ReviewerName; best possible ratings means the highest rating = 5\nHow many customers gave a product the best possible rating? Please list their names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT ReviewerName FROM ProductReview WHERE Rating = 5",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT ReviewerName FROM ProductReview WHERE Rating = 5",
"index": 3341,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomers' name refers to ReviewerName; best possible ratings means the highest rating = 5\nHow many customers gave a product the best possible rating? Please list their names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npoor credit rating means bad credit; CreditRating = 5; Business number refers to BusinessEntityID\nWhat are the company that Adventure Works deal with that have poor credit rating? Please provide their business number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )",
"index": 3342,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npoor credit rating means bad credit; CreditRating = 5; Business number refers to BusinessEntityID\nWhat are the company that Adventure Works deal with that have poor credit rating? Please provide their business number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductModelID integer, -- example: [6, 33]\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationLevel integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nperson number 322 refers to PersonID = 18; job is the name of contacttype\nWhat job is person number 322 currently holding?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID WHERE T2.BusinessEntityID = 332",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID WHERE T2.BusinessEntityID = 332",
"index": 3343,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductModelID integer, -- example: [6, 33]\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationLevel integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nperson number 322 refers to PersonID = 18; job is the name of contacttype\nWhat job is person number 322 currently holding?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['US', 'ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['US', 'ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness along with their IDs = BusinessEntityID; Cellphones refers to PhoneNumberType.name = ‘cell’\nPlease list 3 businesses along with their IDs that use cellphones.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3",
"index": 3344,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['US', 'ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['US', 'ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness along with their IDs = BusinessEntityID; Cellphones refers to PhoneNumberType.name = ‘cell’\nPlease list 3 businesses along with their IDs that use cellphones.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Brazil', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the currency of Brazil?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Name FROM Currency AS T1 INNER JOIN CountryRegionCurrency AS T2 ON T1.CurrencyCode = T2.CurrencyCode INNER JOIN CountryRegion AS T3 ON T2.CountryRegionCode = T3.CountryRegionCode WHERE T3.Name = 'Brazil'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Name FROM Currency AS T1 INNER JOIN CountryRegionCurrency AS T2 ON T1.CurrencyCode = T2.CurrencyCode INNER JOIN CountryRegion AS T3 ON T2.CountryRegionCode = T3.CountryRegionCode WHERE T3.Name = 'Brazil'",
"index": 3345,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Brazil', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the currency of Brazil?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Finance', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many people work in the finance department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T1.Name = 'Finance'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T1.Name = 'Finance'",
"index": 3346,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Finance', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many people work in the finance department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Class text, -- example: ['L', 'M']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Steel', 'Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['English', 'Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSaved in English refers to product description written in English where Culture.name = 'English'\nWhich chromoly steel product model has AdventureWorks saved in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'",
"index": 3347,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Class text, -- example: ['L', 'M']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Steel', 'Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['English', 'Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSaved in English refers to product description written in English where Culture.name = 'English'\nWhich chromoly steel product model has AdventureWorks saved in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['S', '58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographical location refers to group from SalesPerson; ComissionPct refers to commission percentage where ComissionPct > = 0.018;\nPlease list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018",
"index": 3348,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['S', '58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographical location refers to group from SalesPerson; ComissionPct refers to commission percentage where ComissionPct > = 0.018;\nPlease list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductLine text, -- example: ['R', 'S']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n TerritoryID integer, -- example: [5, 6]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['English', 'Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nData saved in English refers to the name of the language where Culture.Name = 'English'; data saved in Arabic refers to the name of the language where Culture.Name = 'Arabic'; SUBTRACT(count(Name = 'English'), count(Name = 'Bothell'))\nHow much do the works data saved in English and Arabic differ from one another?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T1.Name = 'English' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.Name = 'Arabic' THEN 1 ELSE 0 END) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID WHERE T1.Name = 'English' OR T1.Name = 'Arabic'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.Name = 'English' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.Name = 'Arabic' THEN 1 ELSE 0 END) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID WHERE T1.Name = 'English' OR T1.Name = 'Arabic'",
"index": 3349,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['DO', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductLine text, -- example: ['R', 'S']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n TerritoryID integer, -- example: [5, 6]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['DO', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['English', 'Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nData saved in English refers to the name of the language where Culture.Name = 'English'; data saved in Arabic refers to the name of the language where Culture.Name = 'Arabic'; SUBTRACT(count(Name = 'English'), count(Name = 'Bothell'))\nHow much do the works data saved in English and Arabic differ from one another?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLocation refers to AddressLine1; business number refers to the BusinessEntityID where BusinessEntityID = 1\nWhat is the location of business number 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 USING (AddressID) WHERE T2.BusinessEntityID = 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 USING (AddressID) WHERE T2.BusinessEntityID = 1",
"index": 3350,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLocation refers to AddressLine1; business number refers to the BusinessEntityID where BusinessEntityID = 1\nWhat is the location of business number 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['MY', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['M', 'R', 'S']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesPersonID integer, -- example: [279, 282]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['MY', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to Gender = 'M'; employee refers to PersonType = 'EM'; percentage = DIVIDE(COUNT(Gender = 'M'), COUNT(PersonType = 'MY'))*100%;\nWhat percentage of AdventureWorks employees are men?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'",
"index": 3351,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['MY', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['M', 'R', 'S']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesPersonID integer, -- example: [279, 282]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['MY', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale refers to Gender = 'M'; employee refers to PersonType = 'EM'; percentage = DIVIDE(COUNT(Gender = 'M'), COUNT(PersonType = 'MY'))*100%;\nWhat percentage of AdventureWorks employees are men?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n ProductLine text, -- example: ['R', 'S']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAddress number 15873 refers to AddressID = '15873'; IsOnlyStateProvinceCode = '0' refers to StateProvinceCode exists; IsOnlyStateProvinceCode = '1' refers to StateProvinceCode unavailable;\nWhere is the address 15873 located, in what city and state? Does that city belong to a province where the code exists?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"index": 3352,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n ProductLine text, -- example: ['R', 'S']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAddress number 15873 refers to AddressID = '15873'; IsOnlyStateProvinceCode = '0' refers to StateProvinceCode exists; IsOnlyStateProvinceCode = '1' refers to StateProvinceCode unavailable;\nWhere is the address 15873 located, in what city and state? Does that city belong to a province where the code exists?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n MaritalStatus text, -- example: ['S', 'M']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFull address refers to AddressLine1+AddressLine2; business number 24 refers to BusinessEntityID = '24'\nWhat is the full address of business number 24?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24",
"index": 3353,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n MaritalStatus text, -- example: ['S', 'M']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFull address refers to AddressLine1+AddressLine2; business number 24 refers to BusinessEntityID = '24'\nWhat is the full address of business number 24?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Emma', 'Ken', 'Terri']\n MiddleName text, -- example: ['H', 'S', 'J', 'Lee']\n LastName text, -- example: ['Harris', 'Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat's Emma H Harris's Business Entity ID number?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT BusinessEntityID FROM Person WHERE FirstName = 'Emma' AND LastName = 'Harris'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT BusinessEntityID FROM Person WHERE FirstName = 'Emma' AND LastName = 'Harris'",
"index": 3354,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Emma', 'Ken', 'Terri']\n MiddleName text, -- example: ['H', 'S', 'J', 'Lee']\n LastName text, -- example: ['Harris', 'Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat's Emma H Harris's Business Entity ID number?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FolderFlag integer, -- example: [1, 0]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Manufacturing', 'Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDebur and Polish is name of manufacturing location\nWhat is the location id for Debur and Polish?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT LocationID FROM Location WHERE Name = 'Debur and Polish'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT LocationID FROM Location WHERE Name = 'Debur and Polish'",
"index": 3355,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FolderFlag integer, -- example: [1, 0]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Manufacturing', 'Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDebur and Polish is name of manufacturing location\nWhat is the location id for Debur and Polish?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the Shift start time for Shift ID No.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT StartTime FROM Shift WHERE ShiftID = '2'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT StartTime FROM Shift WHERE ShiftID = '2'",
"index": 3356,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n Status integer, -- example: [5]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the Shift start time for Shift ID No.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['OVERSEAS - DELUXE', 'CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Size text, -- example: ['58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Shipping', 'Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMinimum shipping charge refers to ShipBase; OVERSEAS - DELUXE is name of shipping company\nWhat is the minimum shipping charge for \"OVERSEAS - DELUXE\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT ShipBase FROM ShipMethod WHERE Name = 'OVERSEAS - DELUXE'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT ShipBase FROM ShipMethod WHERE Name = 'OVERSEAS - DELUXE'",
"index": 3357,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['OVERSEAS - DELUXE', 'CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Size text, -- example: ['58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Shipping', 'Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMinimum shipping charge refers to ShipBase; OVERSEAS - DELUXE is name of shipping company\nWhat is the minimum shipping charge for \"OVERSEAS - DELUXE\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['FR', 'US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['fr', 'en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['fr', 'ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['FR', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['FR', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SizeUnitMeasureCode text, -- example: ['CM']\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntell the meaning is to find the name of culture\nPlease tell the meaning of CultureID \"fr\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Name FROM Culture WHERE CultureID = 'fr'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT Name FROM Culture WHERE CultureID = 'fr'",
"index": 3358,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['FR', 'US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['fr', 'en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['fr', 'ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['FR', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n SickLeaveHours integer, -- example: [69, 20]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['FR', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SizeUnitMeasureCode text, -- example: ['CM']\n Style text, -- example: ['U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntell the meaning is to find the name of culture\nPlease tell the meaning of CultureID \"fr\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['S', 'J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the product ID No.793's model name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Name FROM Product AS T1 INNER JOIN ProductModel AS T2 ON T1.ProductModelID = T2.ProductModelID WHERE T1.ProductID = 793",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Name FROM Product AS T1 INNER JOIN ProductModel AS T2 ON T1.ProductModelID = T2.ProductModelID WHERE T1.ProductID = 793",
"index": 3359,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['S', 'J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the product ID No.793's model name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the unit measure codes for product ID No.762?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.UnitMeasureCode FROM Product AS T1 INNER JOIN UnitMeasure AS T2 ON T1.SizeUnitMeasureCode = T2.UnitMeasureCode OR T1.WeightUnitMeasureCode = T2.UnitMeasureCode WHERE T1.ProductID = 762 GROUP BY T1.ProductID, T2.UnitMeasureCode",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.UnitMeasureCode FROM Product AS T1 INNER JOIN UnitMeasure AS T2 ON T1.SizeUnitMeasureCode = T2.UnitMeasureCode OR T1.WeightUnitMeasureCode = T2.UnitMeasureCode WHERE T1.ProductID = 762 GROUP BY T1.ProductID, T2.UnitMeasureCode",
"index": 3360,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n MaritalStatus text, -- example: ['S', 'M']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the unit measure codes for product ID No.762?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Assembly', 'Documents', 'Overview']\n FileName text, -- example: ['Assembly', 'Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Components', 'Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['S', 'A', 'B']\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n DaysToManufacture integer, -- example: [0, 1]\n DiscontinuedDate datetime,\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOn going assembly item means the assembly item haven't been finished, therefore EndDate is null\nFor the on going assembly item Component ID No. 494, what's the Unit measure for it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.ComponentID = 494 AND T1.EndDate IS NULL GROUP BY T2.name",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.ComponentID = 494 AND T1.EndDate IS NULL GROUP BY T2.name",
"index": 3361,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Assembly', 'Documents', 'Overview']\n FileName text, -- example: ['Assembly', 'Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Components', 'Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['S', 'A', 'B']\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n DaysToManufacture integer, -- example: [0, 1]\n DiscontinuedDate datetime,\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOn going assembly item means the assembly item haven't been finished, therefore EndDate is null\nFor the on going assembly item Component ID No. 494, what's the Unit measure for it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['he', 'en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['HE', '01', '02']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['he', 'ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Document Control Assistant', 'Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1975-12-25', '1975-12-21', '1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDocument Control Assistant refers to the JobTitle = 'Document Control Assistant'; born on 1975/12/25 refers to BirthDate = '1975-12-25'; private documents indicate that DocumentSummary is null\nFor the document Control Assistant who was born on 1975/12/25, how many private documents did he/she have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL",
"index": 3362,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['he', 'en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['HE', '01', '02']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['he', 'ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Document Control Assistant', 'Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1975-12-25', '1975-12-21', '1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDocument Control Assistant refers to the JobTitle = 'Document Control Assistant'; born on 1975/12/25 refers to BirthDate = '1975-12-25'; private documents indicate that DocumentSummary is null\nFor the document Control Assistant who was born on 1975/12/25, how many private documents did he/she have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n TerritoryID integer, -- example: [5, 6]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Price', 'Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProfit as 82.41 = SUTRACT(ListPrice, StandardCost); May of 2012 refers to StartDate = '2012-05'\nTo the products which could make the profit as 21.9037, what were their list price after October of 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'",
"index": 3363,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n TerritoryID integer, -- example: [5, 6]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Price', 'Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProfit as 82.41 = SUTRACT(ListPrice, StandardCost); May of 2012 refers to StartDate = '2012-05'\nTo the products which could make the profit as 21.9037, what were their list price after October of 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n TerritoryID integer, -- example: [5, 6]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the size of the photo of product id No.1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.ThumbNailPhoto FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T2.ProductID = 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.ThumbNailPhoto FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T2.ProductID = 1",
"index": 3364,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n TerritoryID integer, -- example: [5, 6]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the size of the photo of product id No.1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['HL Mountain Pedal', 'ML Mountain Pedal', 'LL Mountain Pedal', 'All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['Jill', 'John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Review', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['HL Mountain Pedal', 'ML Mountain Pedal', 'LL Mountain Pedal', 'AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJill refers to the name of reviewer; HL Mountain Pedal refers to the name of the product\nWhat rating did Jill give for HL Mountain Pedal?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'",
"index": 3365,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['HL Mountain Pedal', 'ML Mountain Pedal', 'LL Mountain Pedal', 'All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['Jill', 'John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Review', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['HL Mountain Pedal', 'ML Mountain Pedal', 'LL Mountain Pedal', 'AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJill refers to the name of reviewer; HL Mountain Pedal refers to the name of the product\nWhat rating did Jill give for HL Mountain Pedal?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['France', 'Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n Weight real, -- example: [435.0, 450.0]\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Revision text, -- example: ['0', '4']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['France', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['France', 'Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDoesn't have a State Province Code refers to IsOnlyStateProvinceFlag = 1 where StateProvinceCode is unavailable\nWhat is the number of State Province of France that doesn't have a State Province Code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"index": 3366,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['France', 'Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n Weight real, -- example: [435.0, 450.0]\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Revision text, -- example: ['0', '4']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['France', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['France', 'Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDoesn't have a State Province Code refers to IsOnlyStateProvinceFlag = 1 where StateProvinceCode is unavailable\nWhat is the number of State Province of France that doesn't have a State Province Code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['US', 'FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'US', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'US', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nActiveFlag = 1 means 'Vendor no longer used'; ActiveFlag = 2 means 'Vendor is actively used\nFor person id No.2054, is his/her vendor still active?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.ActiveFlag FROM Vendor AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonID = 2054",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.ActiveFlag FROM Vendor AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonID = 2054",
"index": 3367,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n Size text, -- example: ['58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['US', 'FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'US', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'US', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nActiveFlag = 1 means 'Vendor no longer used'; ActiveFlag = 2 means 'Vendor is actively used\nFor person id No.2054, is his/her vendor still active?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Lynn', 'Ken', 'Terri']\n MiddleName text, -- example: ['N', 'S', 'J', 'Lee']\n LastName text, -- example: ['Tsoflias', 'Lynn', 'Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['S', 'W']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat's Lynn N Tsoflias's job title?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Lynn' AND T1.MiddleName = 'N' AND T1.LastName = 'Tsoflias'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Lynn' AND T1.MiddleName = 'N' AND T1.LastName = 'Tsoflias'",
"index": 3368,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Lynn', 'Ken', 'Terri']\n MiddleName text, -- example: ['N', 'S', 'J', 'Lee']\n LastName text, -- example: ['Tsoflias', 'Lynn', 'Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['S', 'W']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat's Lynn N Tsoflias's job title?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n ShipToAddressID integer, -- example: [985, 921]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Bikes', 'Accessories']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBike refers to the name of the product category, therefore ProductCategoryID = 1\nWhat is the number of the sub categories for bikes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'",
"index": 3369,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n CustomerID integer, -- example: [29825, 29672]\n ShipToAddressID integer, -- example: [985, 921]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Bikes', 'Accessories']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBike refers to the name of the product category, therefore ProductCategoryID = 1\nWhat is the number of the sub categories for bikes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['S', 'R']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-22', '2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Document Control Assistant', 'Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-22', '2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['he', 'en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['he', 'ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDocument Control Assistant refers to the JobTitle = 'Document Control Assistant'; hired on 2009/1/22 means the person's hiring date is HireDate = '2009-01-22'; private documents indicate that DocumentSummary is null; DIVIDE(COUNT(DocumentSummary is null), COUNT(DocumentSummary))*100\nFor the document Control Assistant who was hired on 2009/1/22, what is the percentage of private documents did he/she have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'",
"index": 3370,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Weight real, -- example: [435.0, 450.0]\n ProductLine text, -- example: ['S', 'R']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-22', '2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Document Control Assistant', 'Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-22', '2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['he', 'en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['he', 'ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDocument Control Assistant refers to the JobTitle = 'Document Control Assistant'; hired on 2009/1/22 means the person's hiring date is HireDate = '2009-01-22'; private documents indicate that DocumentSummary is null; DIVIDE(COUNT(DocumentSummary is null), COUNT(DocumentSummary))*100\nFor the document Control Assistant who was hired on 2009/1/22, what is the percentage of private documents did he/she have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n BillToAddressID integer, -- example: [985, 921]\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Percentage', 'Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCellphone referes to the name of the phone type, therefore PhoneNumberTypeID = 1; DIVIDE(COUNT(PhoneNumberTypeID = 1), (COUNT(PhoneNumberTypeID)) as percentage\nFor all phone numbers, what percentage of the total is cell phone?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Name = 'Cell' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Name) FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Name = 'Cell' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Name) FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID",
"index": 3371,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n BillToAddressID integer, -- example: [985, 921]\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n ProductSubcategoryID integer, -- example: [14, 31]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Percentage', 'Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCellphone referes to the name of the phone type, therefore PhoneNumberTypeID = 1; DIVIDE(COUNT(PhoneNumberTypeID = 1), (COUNT(PhoneNumberTypeID)) as percentage\nFor all phone numbers, what percentage of the total is cell phone?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nStocked quantity refers to StockedQty\nWhat is the stocked quantity of products manufactured from location ID 40?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40",
"index": 3372,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nStocked quantity refers to StockedQty\nWhat is the stocked quantity of products manufactured from location ID 40?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n CreditCardID integer, -- example: [16281, 5618]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['EA', 'CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['OZ', 'EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['OZ', 'EA', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Category text, -- example: ['No Discount', 'Reseller']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPre assembly quantity refers to PerAssemblyQty\nWhat are the total per assembly quantity for unit measure code EA, IN and OZ respectively? What are the name of these 3 code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name",
"index": 3373,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n CreditCardID integer, -- example: [16281, 5618]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['EA', 'CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['OZ', 'EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['OZ', 'EA', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Category text, -- example: ['No Discount', 'Reseller']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPre assembly quantity refers to PerAssemblyQty\nWhat are the total per assembly quantity for unit measure code EA, IN and OZ respectively? What are the name of these 3 code?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Accountant', 'Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAccountants refers to JobTitle = 'Accountant'; full name includes FirstName, LastName, and MiddleName\nState the full name of accountants in the company.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Accountant'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Accountant'",
"index": 3374,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Accountant', 'Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAccountants refers to JobTitle = 'Accountant'; full name includes FirstName, LastName, and MiddleName\nState the full name of accountants in the company.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['SP', 'EM']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales people refer to PersonType = 'SP'; projected yearly sales refers to SalesQuota\nWhich sales person achieved the highest sales YTD? What is the projected yearly sales quota in 2011 for this person?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.BusinessEntityID, SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2011' GROUP BY T1.BusinessEntityID ORDER BY SUM(T1.SalesYTD) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.BusinessEntityID, SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2011' GROUP BY T1.BusinessEntityID ORDER BY SUM(T1.SalesYTD) DESC LIMIT 1",
"index": 3375,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['SP', 'EM']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n SalariedFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales people refer to PersonType = 'SP'; projected yearly sales refers to SalesQuota\nWhich sales person achieved the highest sales YTD? What is the projected yearly sales quota in 2011 for this person?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ReorderPoint integer, -- example: [750, 600]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['YE', 'ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprojected sales quota refers to SalesQuota; projected sales quota in 2013 refers to year(QuotaDate) = 2013;\nAmong the sales people who achieved projected sales quota 2013, is there any person from territory ID 1? If yes, state the business entity ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.BusinessEntityID FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.TerritoryID = 1 AND STRFTIME('%Y', QuotaDate) = '2013'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT DISTINCT T1.BusinessEntityID FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.TerritoryID = 1 AND STRFTIME('%Y', QuotaDate) = '2013'",
"index": 3376,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n Gender text, -- example: ['M', 'F']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ReorderPoint integer, -- example: [750, 600]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['YE', 'ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprojected sales quota refers to SalesQuota; projected sales quota in 2013 refers to year(QuotaDate) = 2013;\nAmong the sales people who achieved projected sales quota 2013, is there any person from territory ID 1? If yes, state the business entity ID.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Human Resources', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployees that submitted resume to Human Resource Department and got hired refers to BusinessEntittyID NOT null;\nWho are the employees that submitted resume to Human Resource Department and got hired? State the last name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.LastName FROM Employee AS T1 INNER JOIN JobCandidate AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.BusinessEntityID IN (212, 274)",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T3.LastName FROM Employee AS T1 INNER JOIN JobCandidate AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.BusinessEntityID IN (212, 274)",
"index": 3377,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n Revision text, -- example: ['0', '4']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Human Resources', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n PRIMARY KEY (SpecialOfferID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployees that submitted resume to Human Resource Department and got hired refers to BusinessEntittyID NOT null;\nWho are the employees that submitted resume to Human Resource Department and got hired? State the last name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the color of products that were reviewed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Color FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 709 OR 937 OR 798",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Color FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 709 OR 937 OR 798",
"index": 3378,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n CreditRating integer, -- example: [1, 2]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the color of products that were reviewed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Revision text, -- example: ['0', '4']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n MakeFlag integer, -- example: [0, 1]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['M', 'L']\n Style text, -- example: ['M', 'U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['E', 'M', 'F', 'A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to Gender = 'F'; employee who wish to receive email promotion refers to EmailPromotion = 1; percentage = DIVIDE(SUM(Gender = 'F')), (sum(Gender = 'F' or Gender = 'M'))) as percentage;\nAmong the employees who wish to receive e-mail promotion from AdventureWorks, how many percent of them are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.Gender = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.Gender = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1",
"index": 3379,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['M', 'S']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n Freight real, -- example: [616.0984, 38.8276]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Revision text, -- example: ['0', '4']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n MakeFlag integer, -- example: [0, 1]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['M', 'L']\n Style text, -- example: ['M', 'U', 'W']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['E', 'M', 'F', 'A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale refers to Gender = 'F'; employee who wish to receive email promotion refers to EmailPromotion = 1; percentage = DIVIDE(SUM(Gender = 'F')), (sum(Gender = 'F' or Gender = 'M'))) as percentage;\nAmong the employees who wish to receive e-mail promotion from AdventureWorks, how many percent of them are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['Vista', 'SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Revision text, -- example: ['0', '4']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of credit card refers to CardType; CardType = 'Vista';\nHow many types of credit cards are there and how many are vista?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(CardNumber) FROM CreditCard WHERE CardType = 'vista'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(CardNumber) FROM CreditCard WHERE CardType = 'vista'",
"index": 3380,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['Vista', 'SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Revision text, -- example: ['0', '4']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of credit card refers to CardType; CardType = 'Vista';\nHow many types of credit cards are there and how many are vista?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n Weight real, -- example: [435.0, 450.0]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the name of the product with the id \"475\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Name FROM Product WHERE ProductID = 475",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT Name FROM Product WHERE ProductID = 475",
"index": 3381,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n LastName text, -- example: ['Sánchez', 'Duffy']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n Weight real, -- example: [435.0, 450.0]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the name of the product with the id \"475\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AG', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npay rate refers to Rate; 20 years old at the time of being hired refers to SUBTRACT(year(HireDate)), (year(BirthDate))) = 20;\nList all the pay rates of all employees that were hired at 20 years of age.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Rate FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) = 20",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Rate FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) = 20",
"index": 3382,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AG', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npay rate refers to Rate; 20 years old at the time of being hired refers to SUBTRACT(year(HireDate)), (year(BirthDate))) = 20;\nList all the pay rates of all employees that were hired at 20 years of age.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness id refers to BusinessEntityID\nWhat is the name of the territory assigned to the sales person with business id \"277\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"index": 3383,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n NameStyle integer, -- example: [0]\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ActualCost real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness id refers to BusinessEntityID\nWhat is the name of the territory assigned to the sales person with business id \"277\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n SalesPersonID integer, -- example: [279, 282]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Shipping', 'Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCatgo Transport 5 is a name of shipping method; OrderDate = '2011-12-14'; total shipment cost = SUM(Freight);\nWhat is the total shipment by \"cargo transport 5\" cost of all purchase orders created on 12/14/2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(t2.freight) FROM ShipMethod AS t1 INNER JOIN PurchaseOrderHeader AS t2 ON t1.shipmethodid = t2.shipmethodid WHERE t1.name = 'cargo transport 5' AND t2.orderdate = '2011-12-14'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT SUM(t2.freight) FROM ShipMethod AS t1 INNER JOIN PurchaseOrderHeader AS t2 ON t1.shipmethodid = t2.shipmethodid WHERE t1.name = 'cargo transport 5' AND t2.orderdate = '2011-12-14'",
"index": 3384,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n SalesPersonID integer, -- example: [279, 282]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Shipping', 'Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n ReorderPoint integer, -- example: [750, 600]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCatgo Transport 5 is a name of shipping method; OrderDate = '2011-12-14'; total shipment cost = SUM(Freight);\nWhat is the total shipment by \"cargo transport 5\" cost of all purchase orders created on 12/14/2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n MaritalStatus text, -- example: ['S', 'M']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Canada', 'Australia']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n Freight real, -- example: [616.0984, 38.8276]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Canada', 'Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCanada is name of sales territory\nHow many customers are there in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"index": 3385,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n MaritalStatus text, -- example: ['S', 'M']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Canada', 'Australia']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n Freight real, -- example: [616.0984, 38.8276]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Canada', 'Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n StateProvinceID integer, -- example: [57, 7]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCanada is name of sales territory\nHow many customers are there in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSickLeaveHours>65;\nList the first names of the people with more than 65 sick leave hours.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.SickLeaveHours > 65",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.SickLeaveHours > 65",
"index": 3386,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n SickLeaveHours integer, -- example: [69, 20]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSickLeaveHours>65;\nList the first names of the people with more than 65 sick leave hours.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduction technician is a job title; below average rate refers to Rate<AVG(Rate);\nAmong all the production technicians, how many have a below average pay rate for a production technician?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T2.Rate < ( SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' )",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T2.Rate < ( SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' )",
"index": 3387,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FolderFlag integer, -- example: [1, 0]\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduction technician is a job title; below average rate refers to Rate<AVG(Rate);\nAmong all the production technicians, how many have a below average pay rate for a production technician?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['United Kingdom', 'Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['United Kingdom', 'Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproportion = DIVIDE(SUM(Name = 'UK')), (COUNT(SalesOrderID))) as count;\nWhat proportion of sales orders are made from the United Kingdom?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Name = 'United Kingdom' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SalesOrderID) FROM SalesOrderHeader AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Name = 'United Kingdom' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SalesOrderID) FROM SalesOrderHeader AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID",
"index": 3388,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n ChangeNumber integer, -- example: [0, 28]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductSubcategoryID integer, -- example: [14, 31]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['United Kingdom', 'Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['United Kingdom', 'Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n Gender text, -- example: ['M', 'F']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproportion = DIVIDE(SUM(Name = 'UK')), (COUNT(SalesOrderID))) as count;\nWhat proportion of sales orders are made from the United Kingdom?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Purchasing', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive vendors refers to ActiveFlag = 1; vendor who offer a purchasing web service refers to PurchasingWebServiceURL NOT null;\nList all active vendors who offer a purchasing web service.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT Name FROM Vendor WHERE ActiveFlag = 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT Name FROM Vendor WHERE ActiveFlag = 1",
"index": 3389,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n SizeUnitMeasureCode text, -- example: ['CM']\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Purchasing', 'Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive vendors refers to ActiveFlag = 1; vendor who offer a purchasing web service refers to PurchasingWebServiceURL NOT null;\nList all active vendors who offer a purchasing web service.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['Customer', 'No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nModifiedDate between'2014-09-12 00:00:00' and '2014-09-12 23:59:59';\nWhich territory has the most customers as of 9/12/2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT TerritoryID FROM Customer WHERE ModifiedDate < '2014-12-09' GROUP BY TerritoryID ORDER BY COUNT(TerritoryID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT TerritoryID FROM Customer WHERE ModifiedDate < '2014-12-09' GROUP BY TerritoryID ORDER BY COUNT(TerritoryID) DESC LIMIT 1",
"index": 3390,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Category text, -- example: ['Customer', 'No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n TerritoryID integer, -- example: [6, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n CurrencyRateID integer, -- example: [4, 8]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nModifiedDate between'2014-09-12 00:00:00' and '2014-09-12 23:59:59';\nWhich territory has the most customers as of 9/12/2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['Minipump', 'All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['Minipump', 'AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n MaritalStatus text, -- example: ['S', 'M']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMinipump is name of a product\nHow many Minipumps have been sold?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(OrderQty) FROM SalesOrderDetail WHERE ProductID IN ( SELECT ProductID FROM Product WHERE Name = 'Minipump' )",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(OrderQty) FROM SalesOrderDetail WHERE ProductID IN ( SELECT ProductID FROM Product WHERE Name = 'Minipump' )",
"index": 3391,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n FileExtension text, -- example: ['.doc']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['Minipump', 'All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['Minipump', 'AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n MaritalStatus text, -- example: ['S', 'M']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMinipump is name of a product\nHow many Minipumps have been sold?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['S', '58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductLine text, -- example: ['S', 'R']\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['Vista', 'SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness id refers to BusinessEntityID\nWhat is the person's business ID with a vista credit card number \"11113366963373\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373",
"index": 3392,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['S', '58', 'M']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductLine text, -- example: ['S', 'R']\n Class text, -- example: ['L', 'M']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['Vista', 'SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n ComponentID integer, -- example: [749, 750]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness id refers to BusinessEntityID\nWhat is the person's business ID with a vista credit card number \"11113366963373\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Home', 'Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Home', 'Cell']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhere the person live refers addresstype.Name = 'Home'\nWhere does the person with the BusinessEntityID \"5555\" live?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.City, T3.AddressLine1 FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID INNER JOIN Address AS T3 ON T1.AddressID = T3.AddressID WHERE T1.BusinessEntityID = 5555 AND T2.Name = 'Home'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T3.City, T3.AddressLine1 FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID INNER JOIN Address AS T3 ON T1.AddressID = T3.AddressID WHERE T1.BusinessEntityID = 5555 AND T2.Name = 'Home'",
"index": 3393,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Home', 'Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n Gender text, -- example: ['M', 'F']\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n TerritoryID integer, -- example: [5, 6]\n BillToAddressID integer, -- example: [985, 921]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Home', 'Cell']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhere the person live refers addresstype.Name = 'Home'\nWhere does the person with the BusinessEntityID \"5555\" live?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductLine text, -- example: ['R', 'S']\n Style text, -- example: ['U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n MaritalStatus text, -- example: ['S', 'M']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the names of products with the special offer \"15\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Name FROM SpecialOfferProduct AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.SpecialOfferID = 15",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Name FROM SpecialOfferProduct AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.SpecialOfferID = 15",
"index": 3394,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SizeUnitMeasureCode text, -- example: ['CM']\n ProductLine text, -- example: ['R', 'S']\n Style text, -- example: ['U', 'W']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n MaritalStatus text, -- example: ['S', 'M']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the names of products with the special offer \"15\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Michelle', 'Michele', 'Ken', 'Terri']\n MiddleName text, -- example: ['E', 'J', 'Lee']\n LastName text, -- example: ['Cox', 'Sánchez', 'Duffy']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncredit card number refers to CreditCardID\nWhat is the credit card number for Michelle E Cox?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN CreditCard AS T3 ON T2.CreditCardID = T3.CreditCardID WHERE T1.FirstName = 'Michelle' AND T1.MiddleName = 'E' AND T1.LastName = 'Cox'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T3.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN CreditCard AS T3 ON T2.CreditCardID = T3.CreditCardID WHERE T1.FirstName = 'Michelle' AND T1.MiddleName = 'E' AND T1.LastName = 'Cox'",
"index": 3395,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Michelle', 'Michele', 'Ken', 'Terri']\n MiddleName text, -- example: ['E', 'J', 'Lee']\n LastName text, -- example: ['Cox', 'Sánchez', 'Duffy']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n StartDate datetime, -- example: ['2010-05-26 00:00:00.0', '2010-03-04 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileExtension text, -- example: ['.doc']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Weight real, -- example: [435.0, 450.0]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxRate real, -- example: [14.0, 14.25]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncredit card number refers to CreditCardID\nWhat is the credit card number for Michelle E Cox?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreason means the category of sales reason which refers to ReasonType\nWhat is the reason for sales order \"51883\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 51883",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 51883",
"index": 3396,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2014-12-26 09:17:08.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n UnitPriceDiscount real, -- example: [0.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Sales', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n SalesPersonID integer, -- example: [279, 282]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n PRIMARY KEY (ShiftID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreason means the category of sales reason which refers to ReasonType\nWhat is the reason for sales order \"51883\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the credit card number for the sales order \"45793\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.CardNumber FROM SalesOrderHeader AS T1 INNER JOIN CreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.SalesOrderID = 45793",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.CardNumber FROM SalesOrderHeader AS T1 INNER JOIN CreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.SalesOrderID = 45793",
"index": 3397,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n MiddleName text, -- example: ['J', 'Lee']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-06-30 00:00:00.0', '2007-11-21 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n CostLastYear real, -- example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n StockedQty real, -- example: [3.0, 550.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n rowguid text, -- example: ['000310C0-BCC8-42C4-B0C3-45AE611AF06B', '02C5061D-ECDC-4274-B5F1-E91D76BC3F37']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n MaritalStatus text, -- example: ['S', 'M']\n VacationHours integer, -- example: [99, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the credit card number for the sales order \"45793\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Production', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest pay rate refers to MAX(Rate);\nWhich Production Technician has the highest pay rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' ORDER BY T2.Rate DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' ORDER BY T2.Rate DESC LIMIT 1",
"index": 3398,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n CustomerID integer, -- example: [29825, 29672]\n ShipMethodID integer, -- example: [5, 1]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['01', '02']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n Type text, -- example: ['No Discount', 'Volume Discount']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Production', 'Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n ReorderPoint integer, -- example: [750, 600]\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n Style text, -- example: ['U', 'W']\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n DiscontinuedDate datetime,\n rowguid text, -- example: ['01A8C3FC-ED52-458E-A634-D5B6E2ACCFED', '01C901E3-4323-48ED-AB9E-9BFDA28BDEF6']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest pay rate refers to MAX(Rate);\nWhich Production Technician has the highest pay rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ReorderPoint integer, -- example: [750, 600]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the description of the discount for the product with the id \"762\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.Description FROM SpecialOfferProduct AS T1 INNER JOIN SpecialOffer AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.ProductID = 762",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Description FROM SpecialOfferProduct AS T1 INNER JOIN SpecialOffer AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.ProductID = 762",
"index": 3399,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FolderFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n StandardPrice real, -- example: [47.87, 39.92]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n CustomerID integer, -- example: [29825, 29672]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n ModifiedDate datetime, -- example: ['2013-12-29 13:51:58.0']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ReorderPoint integer, -- example: [750, 600]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n RejectedQty real, -- example: [0.0, 1.0]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the description of the discount for the product with the id \"762\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.