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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 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 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 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 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 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 rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\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 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 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 BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\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 Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n DaysToManufacture integer, -- example: [0, 1]\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 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 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 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 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 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 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 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 SalesPersonID integer, -- example: [279, 282]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nperson with id refers to BusinessEntityID;\nWhat is the phone number of the person with id \"12597\"?\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 PhoneNumber FROM PersonPhone WHERE BusinessEntityID = 12597",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT PhoneNumber FROM PersonPhone WHERE BusinessEntityID = 12597",
"index": 3500,
"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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 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 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 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 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 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 rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\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 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 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 BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\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 Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n DaysToManufacture integer, -- example: [0, 1]\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 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 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 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 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 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 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 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 SalesPersonID integer, -- example: [279, 282]\n ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nperson with id refers to BusinessEntityID;\nWhat is the phone number of the person with id \"12597\"?\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 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 Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\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 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 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 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 Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\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 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 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 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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\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 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 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 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 PRIMARY KEY (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 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 SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n PRIMARY KEY (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 TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\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 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 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 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 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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\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 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 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 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 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 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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\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 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 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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\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 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 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 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 ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\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 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 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 ReferenceOrderID integer, -- example: [41590, 41591]\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 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 FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nListPrice>1000;\nList all the names of the products with the price of more than 1000$.\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.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice > 1000",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT DISTINCT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice > 1000",
"index": 3501,
"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 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 Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\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 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 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 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 Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\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 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 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 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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\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 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 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 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 PRIMARY KEY (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 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 SafetyStockLevel integer, -- example: [1000, 800]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n PRIMARY KEY (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 TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\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 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 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 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 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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\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 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 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 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 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 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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\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 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 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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\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 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 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 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 ShipMethodID integer, -- example: [5, 1]\n SubTotal real, -- example: [20565.6206, 1294.2529]\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 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 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 ReferenceOrderID integer, -- example: [41590, 41591]\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 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 FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nListPrice>1000;\nList all the names of the products with the price of more than 1000$.\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 FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\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 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 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 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 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 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 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 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 Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\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 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 CurrencyRateID integer, -- example: [4, 8]\n PRIMARY KEY (SalesOrderID)\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 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 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 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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\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 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 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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\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 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 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 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 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 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 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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\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 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 CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\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 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 Title 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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\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 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 Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\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 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 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 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 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 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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\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:\nproduct with large photo refers to LargePhoto NOT null;\nWhat are the products with a large photo?\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.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"index": 3502,
"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 FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\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 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 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 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 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 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 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 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 Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\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 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 CurrencyRateID integer, -- example: [4, 8]\n PRIMARY KEY (SalesOrderID)\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 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 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 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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\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 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 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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\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 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 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 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 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 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 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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\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 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 CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\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 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 Title 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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\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 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 Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\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 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 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 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 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 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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\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:\nproduct with large photo refers to LargePhoto NOT null;\nWhat are the products with a large photo?\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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n PRIMARY KEY (DocumentNode)\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 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 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 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 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 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 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 ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\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 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 PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_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 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 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 SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 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 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 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 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 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 OrderQty integer, -- example: [1, 3]\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 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 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 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 ToCurrencyCode text, -- example: ['ARS', 'AUD']\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 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 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 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 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 SalariedFlag integer, -- example: [1, 0]\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 PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\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 ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Socks', '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 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 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 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 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 rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\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 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 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 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 PRIMARY KEY (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 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 ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\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 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 ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\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 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 CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', '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 ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSocks is a name of product subcategory\nList all the socks products.\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.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'",
"index": 3503,
"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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n PRIMARY KEY (DocumentNode)\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 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 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 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 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 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 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 ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\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 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 PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_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 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 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 SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 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 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 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 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 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 OrderQty integer, -- example: [1, 3]\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 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 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 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 ToCurrencyCode text, -- example: ['ARS', 'AUD']\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 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 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 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 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 SalariedFlag integer, -- example: [1, 0]\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 PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\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 ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Socks', '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 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 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 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 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 rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\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 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 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 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 PRIMARY KEY (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 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 ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\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 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 ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\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 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 CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', '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 ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.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 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 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSocks is a name of product subcategory\nList all the socks products.\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 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 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 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 ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\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 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 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 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 Title text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\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 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 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 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 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 ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\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 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 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 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 PRIMARY KEY (ProductModelID)\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 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 CardType text, -- example: ['SuperiorCard', 'Distinguish']\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 TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\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: ['Human Resources Manager', '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 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 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 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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\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 UnitMeasure (\n UnitMeasureCode text, -- example: ['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 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 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 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 Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\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 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 PRIMARY KEY (BusinessEntityID, RateChangeDate)\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 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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\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 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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n PRIMARY KEY (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 Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\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:\nHuman Resources Manager is a job title\nWhat is the organization level for Human Resources Manager?\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 OrganizationLevel FROM Employee WHERE JobTitle = 'Human Resources Manager'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT OrganizationLevel FROM Employee WHERE JobTitle = 'Human Resources Manager'",
"index": 3504,
"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 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 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 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 ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\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 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 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 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 Title text, -- example: ['Documents', 'Overview']\n ChangeNumber integer, -- example: [0, 28]\n PRIMARY KEY (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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\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 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 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 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 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 ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\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 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 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 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 PRIMARY KEY (ProductModelID)\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 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 CardType text, -- example: ['SuperiorCard', 'Distinguish']\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 TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n PRIMARY KEY (TransactionID)\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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\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: ['Human Resources Manager', '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 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 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 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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\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 UnitMeasure (\n UnitMeasureCode text, -- example: ['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 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 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 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 Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\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 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 PRIMARY KEY (BusinessEntityID, RateChangeDate)\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 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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\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 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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n PRIMARY KEY (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 Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\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:\nHuman Resources Manager is a job title\nWhat is the organization level for Human Resources Manager?\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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\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 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 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 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 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 Category text, -- example: ['No Discount', 'Reseller']\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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\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 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 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 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 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 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 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 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 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 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 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 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 Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\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 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 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 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 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 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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\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 Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\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 ProductLine text, -- example: ['R', 'S']\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 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 Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\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 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 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 PRIMARY KEY (AddressID)\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 PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_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 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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\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 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 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 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 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 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 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 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 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 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 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 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 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 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 EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (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 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 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 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 ShipToAddressID integer, -- example: [985, 921]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\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 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 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 CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost refers to StandardCost;\nWhat is the cost and the product number of product with the id \"888\"?\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.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"index": 3505,
"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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n FolderFlag integer, -- example: [1, 0]\n FileName text, -- example: ['Documents', 'Overview']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\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 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 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 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 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 Category text, -- example: ['No Discount', 'Reseller']\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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\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 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 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 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 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 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 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 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 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 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 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 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 Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\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 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 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 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 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 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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\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 Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\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 ProductLine text, -- example: ['R', 'S']\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 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 Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\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 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 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 PRIMARY KEY (AddressID)\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 PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_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 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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\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 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 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 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 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 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 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 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 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 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 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 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 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 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 EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (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 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 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 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 ShipToAddressID integer, -- example: [985, 921]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\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 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 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 CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost refers to StandardCost;\nWhat is the cost and the product number of product with the id \"888\"?\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 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 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 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 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 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 MaritalStatus text, -- example: ['S', 'M']\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 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 CountryRegion (\n CountryRegionCode text, -- example: ['US', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (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 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 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 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 Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\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 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 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 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 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 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 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 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 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 ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['roadster_black_small.gif', '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 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 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 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 SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n PRIMARY KEY (SalesOrderID)\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (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 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 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 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 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 PRIMARY KEY (BillOfMaterialsID)\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 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 PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (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 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 CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\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 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 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: ['US', '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 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 Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\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 PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\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 Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\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 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 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 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 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 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 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 Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\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 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 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 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 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 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 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 SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\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 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 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 `Group` text, -- example: ['North America', 'Europe']\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:\nproducts using roadster_black_small.gif as the thumbnail photo refers to ThumbnailPhotoFileName = 'roadster_black_small.gif';\nHow many products using \"roadster_black_small.gif\" as the thumbnail photo?\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(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'",
"index": 3506,
"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 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 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 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 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 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 MaritalStatus text, -- example: ['S', 'M']\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 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 CountryRegion (\n CountryRegionCode text, -- example: ['US', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (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 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 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 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 Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\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 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 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 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 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 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 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 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 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 ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n ThumbnailPhotoFileName text, -- example: ['roadster_black_small.gif', '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 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 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 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 SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CreditCardApprovalCode text, -- example: ['105041Vi84182', '115213Vi29411']\n PRIMARY KEY (SalesOrderID)\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (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 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 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 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 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 PRIMARY KEY (BillOfMaterialsID)\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 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 PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (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 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 CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\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 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 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: ['US', '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 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 Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\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 PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\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 Color text, -- example: ['Black', 'Silver']\n ReorderPoint integer, -- example: [750, 600]\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 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 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 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 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 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 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 Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\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 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 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 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 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 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 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 SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\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 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 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 `Group` text, -- example: ['North America', 'Europe']\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:\nproducts using roadster_black_small.gif as the thumbnail photo refers to ThumbnailPhotoFileName = 'roadster_black_small.gif';\nHow many products using \"roadster_black_small.gif\" as the thumbnail photo?\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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\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 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 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 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 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 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 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 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 CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\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 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 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 Shelf text, -- example: ['A', 'B']\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 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 CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (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 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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['Lock Ring', 'AWC Logo Cap', 'Adjustable Race']\n ListPrice real, -- example: [0.0, 133.34]\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 Class text, -- example: ['L', 'M']\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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (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 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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\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 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 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 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 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 ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\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 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 ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\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 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 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 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 PRIMARY KEY (JobCandidateID)\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 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 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 Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (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 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 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 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 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 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 MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\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 PRIMARY KEY (BillOfMaterialsID)\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 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 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 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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\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 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 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 Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\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 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 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 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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Container', 'Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompartment refers to Shelf; container refers to Bin; Lock Ring is a name of product\nList the locations ids, compartments and containers for the Lock Ring\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.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'",
"index": 3507,
"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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\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 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 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 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 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 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 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 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 CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\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 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 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 Shelf text, -- example: ['A', 'B']\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 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 CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n StateProvinceCode text, -- example: ['ID', '01', '02']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (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 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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['Lock Ring', 'AWC Logo Cap', 'Adjustable Race']\n ListPrice real, -- example: [0.0, 133.34]\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 Class text, -- example: ['L', 'M']\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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (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 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 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 Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\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 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 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 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 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 ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\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 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 ShipToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\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 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 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 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 PRIMARY KEY (JobCandidateID)\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 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 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 Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (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 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 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 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 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 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 MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\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 PRIMARY KEY (BillOfMaterialsID)\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 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 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 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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\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 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 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 Rate real, -- example: [125.5, 63.4615]\n PayFrequency integer, -- example: [2, 1]\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 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 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 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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Container', 'Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompartment refers to Shelf; container refers to Bin; Lock Ring is a name of product\nList the locations ids, compartments and containers for the Lock Ring\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 ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Handling damage', 'Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\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 PRIMARY KEY (TransactionID)\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 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 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 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 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 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 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 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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\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 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 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 Name text, -- Phone Number, example: ['Work', '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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\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 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 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 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 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 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 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 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 Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\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 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 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 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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (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 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 PRIMARY KEY (AddressTypeID)\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 EndOfDayRate real, -- example: [1.0002, 1.55]\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 Bonus real, -- example: [0.0, 4100.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 SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\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 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 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 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 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 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 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 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 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 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 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 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 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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\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 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 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 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 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 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 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 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 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 SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\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 Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\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 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 ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\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:\nhandling damage is descrription of manufacturing failure which refers to ScrapReason.Name\nList all the scraped work orders for handling damage reason.\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.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage'",
"index": 3508,
"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 ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Handling damage', 'Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\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 PRIMARY KEY (TransactionID)\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 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 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 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 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 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 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 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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\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 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 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 Name text, -- Phone Number, example: ['Work', '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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\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 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 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 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 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 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 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 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 Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\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 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 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 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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n MiddleName text, -- example: ['J', 'Lee']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (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 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 PRIMARY KEY (AddressTypeID)\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 EndOfDayRate real, -- example: [1.0002, 1.55]\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 Bonus real, -- example: [0.0, 4100.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 SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Category text, -- example: ['No Discount', 'Reseller']\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 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 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 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 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 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 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 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 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 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 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 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 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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\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 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 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 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 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 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 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 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 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 SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\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 Freight real, -- example: [616.0984, 38.8276]\n PRIMARY KEY (SalesOrderID)\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 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 ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\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:\nhandling damage is descrription of manufacturing failure which refers to ScrapReason.Name\nList all the scraped work orders for handling damage reason.\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 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 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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n TerritoryID integer, -- example: [5, 6]\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 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 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 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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n PRIMARY KEY (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 ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\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 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 Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\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 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 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 CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\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 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 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 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 ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (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 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 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 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 ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n ProductModelID integer, -- example: [6, 33]\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 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 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 PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\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 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 PRIMARY KEY (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 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 PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (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 Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\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 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 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 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 ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\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 SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\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 ReferenceOrderID integer, -- example: [41590, 41591]\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 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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\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 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:\nprofit = SUBTRACT(ListPrice, StandardCost);\nWhat is the profit for the product \"792\"?\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 - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792",
"index": 3509,
"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 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 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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n TerritoryID integer, -- example: [5, 6]\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 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 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 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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n PRIMARY KEY (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 ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\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 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 Location (\n LocationID integer, -- example: [30, 60]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\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 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 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 CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\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 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 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 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 ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (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 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 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 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 ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Weight real, -- example: [435.0, 450.0]\n ProductModelID integer, -- example: [6, 33]\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 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 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 PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\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 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 PRIMARY KEY (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 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 PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\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 Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (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 Address (\n AddressID integer, -- example: [18089, 23192]\n SpatialLocation text, -- example: ['0x00000000010100000067A89189898A5EC0AE8B', '0x000000000101000000BC262A0A03905EC0D6FA']\n PRIMARY KEY (AddressID)\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 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 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 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 ProductModel (\n ProductModelID integer, -- example: [82, 57]\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\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 AddressType (\n AddressTypeID integer, -- example: [4, 2]\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 SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\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 ReferenceOrderID integer, -- example: [41590, 41591]\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 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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\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 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:\nprofit = SUBTRACT(ListPrice, StandardCost);\nWhat is the profit for the product \"792\"?\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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 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 PRIMARY KEY (TransactionID)\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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\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 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 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 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 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 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 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 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 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 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 Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\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 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 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 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 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 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 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 Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\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 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 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 Name text, -- example: ['Price', 'On Promotion']\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 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 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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 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 Status integer, -- example: [2, 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 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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\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 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 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 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 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 EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['regina7@adventure-works.com', '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 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 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 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 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 `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 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 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 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 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 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 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 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 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 ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\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 SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n PRIMARY KEY (SalesOrderID)\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 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 City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\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 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:\nWho owns the email address \"regina7@adventure-works.com\"?\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 EmailAddress AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailAddress = 'regina7@adventure-works.com'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.FirstName, T2.LastName FROM EmailAddress AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailAddress = 'regina7@adventure-works.com'",
"index": 3510,
"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 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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\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 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 PRIMARY KEY (TransactionID)\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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\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 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 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 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 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 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 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 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 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 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 Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\n Class text, -- example: ['L', 'M']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n PRIMARY KEY (ProductID)\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 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 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 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 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 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 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 Name text, -- example: ['Day', 'Evening']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\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 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 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 Name text, -- example: ['Price', 'On Promotion']\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 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 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 Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 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 Status integer, -- example: [2, 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 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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\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 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 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 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 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 EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['regina7@adventure-works.com', '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 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 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 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 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 `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 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 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 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 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 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 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 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 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 ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\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 SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n PRIMARY KEY (SalesOrderID)\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 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 City text, -- example: ['Ottawa', 'Burnaby']\n PRIMARY KEY (AddressID)\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 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:\nWho owns the email address \"regina7@adventure-works.com\"?\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 Document (\n DocumentNode text, -- example: ['/', '/1/']\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 PRIMARY KEY (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 PRIMARY KEY (TransactionID)\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 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` 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 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 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 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 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 AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\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 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 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 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 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 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 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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\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 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 PRIMARY KEY (BillOfMaterialsID)\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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\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 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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\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 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 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 ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n Weight real, -- example: [435.0, 450.0]\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 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 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 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 ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_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 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 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 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 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 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 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 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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhere are the locations where the product \"810\" is stored?\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 ProductInventory AS T1 INNER JOIN Location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ProductID = 810",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Name FROM ProductInventory AS T1 INNER JOIN Location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ProductID = 810",
"index": 3511,
"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 Document (\n DocumentNode text, -- example: ['/', '/1/']\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 PRIMARY KEY (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 PRIMARY KEY (TransactionID)\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 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` 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 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 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 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 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 AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\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 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 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 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 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 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 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 Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\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 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 Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n FirstName text, -- example: ['Ken', 'Terri']\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 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 PRIMARY KEY (BillOfMaterialsID)\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 ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\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 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 ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\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 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 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 ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n Weight real, -- example: [435.0, 450.0]\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 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 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 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 ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_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 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 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 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 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 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 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 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 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 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 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 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 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 JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhere are the locations where the product \"810\" is stored?\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 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 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 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 FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\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 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 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 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 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 PRIMARY KEY (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 Rating integer, -- example: [5, 4]\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 DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\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 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 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 WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\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 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 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 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` 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 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 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 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 LineTotal real, -- example: [201.0, 135.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 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 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 LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\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 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 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 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 CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\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 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 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 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 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 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 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 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 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 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 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 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 SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\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 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 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 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 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 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 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 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 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 PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\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 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 ReferenceOrderLineID 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 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 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 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 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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\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 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 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 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);\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 the work order \"2540\" was making?\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 WorkOrder AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WorkOrderID = 2540",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.Name FROM WorkOrder AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WorkOrderID = 2540",
"index": 3512,
"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 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 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 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 FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n Suffix text, -- example: ['III', 'Jr.']\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 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 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 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 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 PRIMARY KEY (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 Rating integer, -- example: [5, 4]\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 DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\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 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 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 WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\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 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 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 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` 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 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 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 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 LineTotal real, -- example: [201.0, 135.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 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 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 LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\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 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 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 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 CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\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 UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\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 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 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 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 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 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 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 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 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 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 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 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 SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\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 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 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 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 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 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 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 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 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 PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Work', 'Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\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 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 ReferenceOrderLineID 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 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 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 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 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 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 StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\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 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 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 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);\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 the work order \"2540\" was making?\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 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 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 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 CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\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 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 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 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 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 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 PRIMARY KEY (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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\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 ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (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 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 Name text, -- example: ['Document Control', 'Engineering']\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 FolderFlag integer, -- example: [1, 0]\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 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 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 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 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 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 BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\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 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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['Down Tube', 'AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\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 DiscontinuedDate datetime,\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 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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SalariedFlag integer, -- example: [1, 0]\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\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 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 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 PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\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 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 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 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 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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On 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:\nDown Tube is a name of a product;\nList all the work orders that is related to the Down Tube.\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.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"index": 3513,
"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 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 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 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 CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\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 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 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 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 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 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 PRIMARY KEY (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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\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 ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (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 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 Name text, -- example: ['Document Control', 'Engineering']\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 FolderFlag integer, -- example: [1, 0]\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 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 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 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 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 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 BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\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 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 Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['Down Tube', 'AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n Size text, -- example: ['58', 'M']\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 DiscontinuedDate datetime,\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 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 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 Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n BirthDate date, -- example: ['1969-01-29', '1971-08-01']\n SalariedFlag integer, -- example: [1, 0]\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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\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 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 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 PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n Suffix text, -- example: ['III', 'Jr.']\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 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 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 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 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 SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On 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:\nDown Tube is a name of a product;\nList all the work orders that is related to the Down Tube.\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples refers to OBJ_SAMPLE_ID; image no.1 refers to IMG_ID = 1\nHow many object samples are there in image 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 COUNT(OBJ_SAMPLE_ID) FROM IMG_OBJ WHERE IMG_ID = 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(OBJ_SAMPLE_ID) FROM IMG_OBJ WHERE IMG_ID = 1",
"index": 3514,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples refers to OBJ_SAMPLE_ID; image no.1 refers to IMG_ID = 1\nHow many object samples are there in image 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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID of the image refers to IMG_ID; most number of object samples refers to max(count(OBJ_SAMPLE_ID))\nWhat is the ID of the image with the most number of object samples?\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 IMG_ID FROM IMG_OBJ GROUP BY IMG_ID ORDER BY COUNT(OBJ_SAMPLE_ID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT IMG_ID FROM IMG_OBJ GROUP BY IMG_ID ORDER BY COUNT(OBJ_SAMPLE_ID) DESC LIMIT 1",
"index": 3515,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID of the image refers to IMG_ID; most number of object samples refers to max(count(OBJ_SAMPLE_ID))\nWhat is the ID of the image with the most number of object samples?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nself-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID; image no.5 refers to IMG_ID = 5\nHow many self-relations are there between the object samples in image no.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 SUM(CASE WHEN IMG_ID = 5 THEN 1 ELSE 0 END) FROM IMG_REL WHERE OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN IMG_ID = 5 THEN 1 ELSE 0 END) FROM IMG_REL WHERE OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID",
"index": 3516,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nself-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID; image no.5 refers to IMG_ID = 5\nHow many self-relations are there between the object samples in image no.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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'man', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples refers to OBJ_CLASS_ID; image no.1 refers to IMG_ID = 1; in the class of \"man\" refers to OBJ_CLASS = 'man'\nHow many object samples in image no.1 are in the class of \"man\"?\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.OBJ_CLASS = 'man' THEN 1 ELSE 0 END) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.OBJ_CLASS = 'man' THEN 1 ELSE 0 END) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1",
"index": 3517,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'man', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples refers to OBJ_CLASS_ID; image no.1 refers to IMG_ID = 1; in the class of \"man\" refers to OBJ_CLASS = 'man'\nHow many object samples in image no.1 are in the class of \"man\"?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'man', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave at least one object sample in the class of \"man\" refers to count(IMG_ID where OBJ_CLASS = 'man') > = 1\nHow many images have at least one object sample in the class of \"man\"?\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(T.IMG_ID) FROM ( SELECT T2.IMG_ID FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.OBJ_CLASS = 'man' GROUP BY T2.IMG_ID ) T",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(T.IMG_ID) FROM ( SELECT T2.IMG_ID FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.OBJ_CLASS = 'man' GROUP BY T2.IMG_ID ) T",
"index": 3518,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'man', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave at least one object sample in the class of \"man\" refers to count(IMG_ID where OBJ_CLASS = 'man') > = 1\nHow many images have at least one object sample in the class of \"man\"?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclasses of all the object samples refers to OBJ_CLASS; image no.1 refers to IMG_ID = 1\nPlease list the classes of all the object samples in image 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.OBJ_CLASS FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 GROUP BY T1.OBJ_CLASS",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.OBJ_CLASS FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 GROUP BY T1.OBJ_CLASS",
"index": 3519,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclasses of all the object samples refers to OBJ_CLASS; image no.1 refers to IMG_ID = 1\nPlease list the classes of all the object samples in image 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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelation refers to PRED_CLASS; object sample no.8 and object sample no.4 refers to OBJ1_SAMPLE_ID = 8 AND OBJ2_SAMPLE_ID = 4; image no.1 refers to IMG_ID = 1\nWhat is the relation between object sample no.8 and object sample no.4 in image 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.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID = 8 AND T2.OBJ2_SAMPLE_ID = 4",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID = 8 AND T2.OBJ2_SAMPLE_ID = 4",
"index": 3520,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelation refers to PRED_CLASS; object sample no.8 and object sample no.4 refers to OBJ1_SAMPLE_ID = 8 AND OBJ2_SAMPLE_ID = 4; image no.1 refers to IMG_ID = 1\nWhat is the relation between object sample no.8 and object sample no.4 in image 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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['parked on', 'have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npairs of object samples refers to OBJ1_SAMPLE_ID and OBJ2_SAMPLE_ID; image no.1 refers to IMG_ID = 1; relation of \"parked on\" refers to PRED_CLASS = 'parked on'\nHow many pairs of object samples in image no.1 have the relation of \"parked on\"?\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.PRED_CLASS = 'parked on' THEN 1 ELSE 0 END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != OBJ2_SAMPLE_ID",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE 0 END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != OBJ2_SAMPLE_ID",
"index": 3521,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['parked on', 'have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npairs of object samples refers to OBJ1_SAMPLE_ID and OBJ2_SAMPLE_ID; image no.1 refers to IMG_ID = 1; relation of \"parked on\" refers to PRED_CLASS = 'parked on'\nHow many pairs of object samples in image no.1 have the relation of \"parked on\"?\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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['parked on', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelation \"parked on\" refers to PRED_CLASS = 'parked on'; image no.1 refers to IMG_ID = 1; average difference in the y coordinate = divide(sum(Y), count(PRED_CLASS)) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID\nWhat is the average difference in the y coordinate of 2 object samples with the relation \"parked on\" in image 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 CAST(SUM(T3.Y) AS REAL) / COUNT(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE NULL END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT CAST(SUM(T3.Y) AS REAL) / COUNT(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE NULL END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID",
"index": 3522,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['parked on', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelation \"parked on\" refers to PRED_CLASS = 'parked on'; image no.1 refers to IMG_ID = 1; average difference in the y coordinate = divide(sum(Y), count(PRED_CLASS)) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID\nWhat is the average difference in the y coordinate of 2 object samples with the relation \"parked on\" in image 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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'man', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['man', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples refers to OBJ_SAMPLE_ID; class of \"man\" refers to OBJ_CLASS = 'man'; image no.1 refers to IMG_ID = 1; percentage = divide(count(OBJ_SAMPLE_ID)when OBJ_CLASS = 'man', count(OBJ_SAMPLE_ID)) as percentage\nWhat is the percentage of the object samples in the class of \"man\" in image 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 CAST(COUNT(CASE WHEN T1.OBJ_CLASS = 'man' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.OBJ_CLASS_ID) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.OBJ_CLASS = 'man' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.OBJ_CLASS_ID) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1",
"index": 3523,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'man', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['man', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples refers to OBJ_SAMPLE_ID; class of \"man\" refers to OBJ_CLASS = 'man'; image no.1 refers to IMG_ID = 1; percentage = divide(count(OBJ_SAMPLE_ID)when OBJ_CLASS = 'man', count(OBJ_SAMPLE_ID)) as percentage\nWhat is the percentage of the object samples in the class of \"man\" in image 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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes refers to OBJ_CLASS\nHow many object classes are there in the database?\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(OBJ_CLASS_ID) FROM OBJ_CLASSES",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(OBJ_CLASS_ID) FROM OBJ_CLASSES",
"index": 3524,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes refers to OBJ_CLASS\nHow many object classes are there in the database?\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['white', 'many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'white', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhite objects refers to ATT_CLASS = 'white'; image no.2347915 refers to IMG_ID = 2347915\nHow many white objects are there in image no.2347915?\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 T2.ATT_CLASS = 'white' THEN 1 ELSE 0 END) FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 2347915",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.ATT_CLASS = 'white' THEN 1 ELSE 0 END) FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 2347915",
"index": 3525,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['white', 'many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'white', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhite objects refers to ATT_CLASS = 'white'; image no.2347915 refers to IMG_ID = 2347915\nHow many white objects are there in image no.2347915?\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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['electrical', 'electric', 'number', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\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 samples refers to OBJ_SAMPLE_ID; image no.2377985 refers to IMG_ID = 2377985; attribute is electrical refers to ATT_CLASS = 'electrical'\nGive the number of samples in image no.2377985 whose attribute is electrical.\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 T2.ATT_CLASS = 'white' THEN 1 ELSE 0 END) FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 2347915",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.ATT_CLASS = 'white' THEN 1 ELSE 0 END) FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 2347915",
"index": 3526,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['electrical', 'electric', 'number', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\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 samples refers to OBJ_SAMPLE_ID; image no.2377985 refers to IMG_ID = 2377985; attribute is electrical refers to ATT_CLASS = 'electrical'\nGive the number of samples in image no.2377985 whose attribute is electrical.\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelationship refers to PRED_CLASS; object sample no.12 and no.8 of image no.2345511 refers to IMG_ID = 2345511 AND OBJ1_SAMPLE_ID = 12 AND OBJ2_SAMPLE_ID = 8\nWhat is the relationship between object sample no.12 and no.8 of image no.2345511?\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.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 2345511 AND T2.OBJ1_SAMPLE_ID = 12 AND T2.OBJ2_SAMPLE_ID = 8",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 2345511 AND T2.OBJ1_SAMPLE_ID = 12 AND T2.OBJ2_SAMPLE_ID = 8",
"index": 3527,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelationship refers to PRED_CLASS; object sample no.12 and no.8 of image no.2345511 refers to IMG_ID = 2345511 AND OBJ1_SAMPLE_ID = 12 AND OBJ2_SAMPLE_ID = 8\nWhat is the relationship between object sample no.12 and no.8 of image no.2345511?\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['lying on', 'from', 'has', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject number of the sample refers to OBJ1_SAMPLE_ID; object sample no.1 from image no.2345524 refers to OBJ2_SAMPLE_ID = 1 and IMG_ID = 2345524\nGive the object number of the sample which has the relationship of \"lying on\" with object sample no.1 from image no.2345524.\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.OBJ1_SAMPLE_ID FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 2345524 AND T1.PRED_CLASS = 'lying on' AND T2.OBJ2_SAMPLE_ID = 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.OBJ1_SAMPLE_ID FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 2345524 AND T1.PRED_CLASS = 'lying on' AND T2.OBJ2_SAMPLE_ID = 1",
"index": 3528,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['lying on', 'from', 'has', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject number of the sample refers to OBJ1_SAMPLE_ID; object sample no.1 from image no.2345524 refers to OBJ2_SAMPLE_ID = 1 and IMG_ID = 2345524\nGive the object number of the sample which has the relationship of \"lying on\" with object sample no.1 from image no.2345524.\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'suit', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\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 images refers to IMG_ID; object sample of \"suit\" refers to OBJ_CLASS = 'suit'\nGive the number of images containing the object sample of \"suit\".\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(T.IMG_ID) FROM ( SELECT T2.IMG_ID FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.OBJ_CLASS = 'suit' GROUP BY T2.IMG_ID ) T",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(T.IMG_ID) FROM ( SELECT T2.IMG_ID FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.OBJ_CLASS = 'suit' GROUP BY T2.IMG_ID ) T",
"index": 3529,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'suit', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\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 images refers to IMG_ID; object sample of \"suit\" refers to OBJ_CLASS = 'suit'\nGive the number of images containing the object sample of \"suit\".\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['feathers', 'onion', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelationship refers to PRED_CLASS; \"feathers\" and \"onion\" in image no.2345528 refers to IMG_ID = 2345528 and OBJ_CLASS = 'feathers' and OBJ_CLASS = 'onion'\nWhat is the relationship between \"feathers\" and \"onion\" in image no.2345528?\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.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_SAMPLE_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE (T4.OBJ_CLASS = 'feathers' OR T4.OBJ_CLASS = 'onion') AND T2.IMG_ID = 2345528 GROUP BY T1.PRED_CLASS",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_SAMPLE_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE (T4.OBJ_CLASS = 'feathers' OR T4.OBJ_CLASS = 'onion') AND T2.IMG_ID = 2345528 GROUP BY T1.PRED_CLASS",
"index": 3530,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['feathers', 'onion', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrelationship refers to PRED_CLASS; \"feathers\" and \"onion\" in image no.2345528 refers to IMG_ID = 2345528 and OBJ_CLASS = 'feathers' and OBJ_CLASS = 'onion'\nWhat is the relationship between \"feathers\" and \"onion\" in image no.2345528?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['wall', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsamples of \"wall\" refers to OBJ_SAMPLE_ID and OBJ_CLASS = 'wall' ; image no.2353079 refers to IMG_ID = 2353079\nHow many samples of \"wall\" are there in image no.2353079?\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.OBJ_CLASS = 'wall' THEN 1 ELSE 0 END) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 2353079",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.OBJ_CLASS = 'wall' THEN 1 ELSE 0 END) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 2353079",
"index": 3531,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['wall', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsamples of \"wall\" refers to OBJ_SAMPLE_ID and OBJ_CLASS = 'wall' ; image no.2353079 refers to IMG_ID = 2353079\nHow many samples of \"wall\" are there in image no.2353079?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nids of the images refers to IMG_ID; self-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID\nList all the ids of the images that have a self-relation relationship.\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 IMG_ID FROM IMG_REL WHERE OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT DISTINCT IMG_ID FROM IMG_REL WHERE OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID",
"index": 3532,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nids of the images refers to IMG_ID; self-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID\nList all the ids of the images that have a self-relation relationship.\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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['number', 'many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobjects refers to OBJ_SAMPLE_ID; attribute class id with the highest number of objects refers to max(COUNT(ATT_CLASS_ID))\nHow many objects are there in the attribute class id with the highest number of objects?\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(ATT_CLASS_ID) FROM IMG_OBJ_att GROUP BY IMG_ID ORDER BY COUNT(ATT_CLASS_ID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(ATT_CLASS_ID) FROM IMG_OBJ_att GROUP BY IMG_ID ORDER BY COUNT(ATT_CLASS_ID) DESC LIMIT 1",
"index": 3533,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['number', 'many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobjects refers to OBJ_SAMPLE_ID; attribute class id with the highest number of objects refers to max(COUNT(ATT_CLASS_ID))\nHow many objects are there in the attribute class id with the highest number of objects?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['belonging to', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'train', 'car', 'bus', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nid of all the objects belonging to the transportation class refers to OBJ_CLASS_ID and OBJ_CLASS IN ('bus', 'train', 'aeroplane', 'car', 'etc.')\nWhat are the id of all the objects belonging to the transportation class?\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 OBJ_CLASS_ID FROM OBJ_CLASSES WHERE OBJ_CLASS IN ('bus', 'train', 'aeroplane', 'car', 'etc')",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT OBJ_CLASS_ID FROM OBJ_CLASSES WHERE OBJ_CLASS IN ('bus', 'train', 'aeroplane', 'car', 'etc')",
"index": 3534,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['belonging to', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'train', 'car', 'bus', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nid of all the objects belonging to the transportation class refers to OBJ_CLASS_ID and OBJ_CLASS IN ('bus', 'train', 'aeroplane', 'car', 'etc.')\nWhat are the id of all the objects belonging to the transportation class?\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['bike', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['very large', 'large', 'bike', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute refers to ATT_CLASS\nWhat are the corresponding classes for the \"very large bike\" attribute?\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 ATT_CLASS_ID FROM ATT_CLASSES WHERE ATT_CLASS = 'very large'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT ATT_CLASS_ID FROM ATT_CLASSES WHERE ATT_CLASS = 'very large'",
"index": 3535,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['bike', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['very large', 'large', 'bike', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute refers to ATT_CLASS\nWhat are the corresponding classes for the \"very large bike\" attribute?\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprediction relationship class id refers to PRED_CLASS_ID; tallest image refers to max(H)\nWhat is the prediction relationship class id of the tallest image?\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.PRED_CLASS_ID FROM IMG_REL AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.IMG_ID = T2.IMG_ID ORDER BY T2.H DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.PRED_CLASS_ID FROM IMG_REL AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.IMG_ID = T2.IMG_ID ORDER BY T2.H DESC LIMIT 1",
"index": 3536,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprediction relationship class id refers to PRED_CLASS_ID; tallest image refers to max(H)\nWhat is the prediction relationship class id of the tallest image?\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nself-relation relationship refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID and PRED_CLASS; captions of prediction classes refers to PRED_CLASS\nWhat are the captions of all the self-relation relationship prediction classes?\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.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN pred_classes AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.OBJ1_SAMPLE_ID = T1.OBJ2_SAMPLE_ID GROUP BY T2.PRED_CLASS",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN pred_classes AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.OBJ1_SAMPLE_ID = T1.OBJ2_SAMPLE_ID GROUP BY T2.PRED_CLASS",
"index": 3537,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nself-relation relationship refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID and PRED_CLASS; captions of prediction classes refers to PRED_CLASS\nWhat are the captions of all the self-relation relationship prediction classes?\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['feathers', 'object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding boxes refers to (x, y, W, H); image 2222 refers to IMG_ID = 2222; object classes are feathers refers to OBJ_CLASS = 'feathers'\nGive all the bounding boxes for image 2222 whose object classes are feathers.\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.X, T2.Y, T2.H, T2.W FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 2222 AND T1.OBJ_CLASS = 'feathers'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.X, T2.Y, T2.H, T2.W FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 2222 AND T1.OBJ_CLASS = 'feathers'",
"index": 3538,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['feathers', 'object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding boxes refers to (x, y, W, H); image 2222 refers to IMG_ID = 2222; object classes are feathers refers to OBJ_CLASS = 'feathers'\nGive all the bounding boxes for image 2222 whose object classes are feathers.\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject class of the image refers to OBJ_CLASS; bounding box of 0, 0, 135, 212 refers to X = 0 AND Y = 0 AND W = 135 AND H = 212\nWhat is the object class of the image with a bounding box of 0, 0, 135, 212?\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.OBJ_CLASS FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.X = 0 AND T2.Y = 0 AND T2.W = 135 AND T2.H = 212",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.OBJ_CLASS FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.X = 0 AND T2.Y = 0 AND T2.W = 135 AND T2.H = 212",
"index": 3539,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject class of the image refers to OBJ_CLASS; bounding box of 0, 0, 135, 212 refers to X = 0 AND Y = 0 AND W = 135 AND H = 212\nWhat is the object class of the image with a bounding box of 0, 0, 135, 212?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['keyboard', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndimensions of the bounding box refers to (W, H); keyboard refers to OBJ_CLASS = 'keyboard'; image no. 3 refers to IMG_ID = 3\nProvide the dimensions of the bounding box that contains the keyboard that was spotted in image no. 3.\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.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 3 AND T2.OBJ_CLASS = 'keyboard'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 3 AND T2.OBJ_CLASS = 'keyboard'",
"index": 3540,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['keyboard', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndimensions of the bounding box refers to (W, H); keyboard refers to OBJ_CLASS = 'keyboard'; image no. 3 refers to IMG_ID = 3\nProvide the dimensions of the bounding box that contains the keyboard that was spotted in image no. 3.\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinates on the X and Y axes refers to X and Y; folk refers to OBJ_CLASS = 'folk'; image no. 6 refers to IMG_ID = 6\nIdentify the border's coordinates on the X and Y axes that enclose a folk in image no. 6.\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.X, T1.Y FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 6 AND T2.OBJ_CLASS = 'folk'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.X, T1.Y FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 6 AND T2.OBJ_CLASS = 'folk'",
"index": 3541,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinates on the X and Y axes refers to X and Y; folk refers to OBJ_CLASS = 'folk'; image no. 6 refers to IMG_ID = 6\nIdentify the border's coordinates on the X and Y axes that enclose a folk in image no. 6.\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['onion', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding box refers to (X, Y, W, H); onion refers to OBJ_CLASS = 'onion'; image no.285930 refers to IMG_ID = 285930\nDefine the onion's bounding box on image no. 285930.\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.X, T1.Y, T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 285930 AND T2.OBJ_CLASS = 'onion'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.X, T1.Y, T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 285930 AND T2.OBJ_CLASS = 'onion'",
"index": 3542,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['onion', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding box refers to (X, Y, W, H); onion refers to OBJ_CLASS = 'onion'; image no.285930 refers to IMG_ID = 285930\nDefine the onion's bounding box on image no. 285930.\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'can', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\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 objects refers to OBJ_CLASS_ID; image no. 72 refers to IMG_ID = 72; What objects refers to OBJ_CLASS; bounding box represented as (341, 27, 42, 51) refers to X = 341 and Y = 27 and W = 42 and H = 51\nHow many objects can you spot in image no. 72? What objects may be identified on the same image and within the bounding box represented as (341, 27, 42, 51)?\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(IIF(T1.IMG_ID = 1, 1, 0)), SUM(IIF(T1.X = 341 AND T1.Y = 27 AND T1.W = 42 AND T1.H = 51, 1, 0)) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(IIF(T1.IMG_ID = 1, 1, 0)), SUM(IIF(T1.X = 341 AND T1.Y = 27 AND T1.W = 42 AND T1.H = 51, 1, 0)) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID",
"index": 3543,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'can', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\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 objects refers to OBJ_CLASS_ID; image no. 72 refers to IMG_ID = 72; What objects refers to OBJ_CLASS; bounding box represented as (341, 27, 42, 51) refers to X = 341 and Y = 27 and W = 42 and H = 51\nHow many objects can you spot in image no. 72? What objects may be identified on the same image and within the bounding box represented as (341, 27, 42, 51)?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['scattered', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the object element refers to OBJ_CLASS; scattered refers to ATT_CLASS = 'scattered'; image no. 10 refers to IMG_ID = 10\nName the object element that is described as being scattered on image no. 10.\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.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID INNER JOIN IMG_OBJ_ATT AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN ATT_CLASSES AS T4 ON T3.ATT_CLASS_ID = T4.ATT_CLASS_ID WHERE T4.ATT_CLASS = 'scattered' AND T1.IMG_ID = 10 GROUP BY T2.OBJ_CLASS",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID INNER JOIN IMG_OBJ_ATT AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN ATT_CLASSES AS T4 ON T3.ATT_CLASS_ID = T4.ATT_CLASS_ID WHERE T4.ATT_CLASS = 'scattered' AND T1.IMG_ID = 10 GROUP BY T2.OBJ_CLASS",
"index": 3544,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['scattered', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the object element refers to OBJ_CLASS; scattered refers to ATT_CLASS = 'scattered'; image no. 10 refers to IMG_ID = 10\nName the object element that is described as being scattered on image no. 10.\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['can', 'van', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['spotted', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncolour refers to ATT_CLASS; van refers to OBJ_CLASS = 'van'; image no. 1 refers to IMG_ID = 1\nWhat colour is the van that can be spotted in image 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 T4.ATT_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID INNER JOIN IMG_OBJ_ATT AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN ATT_CLASSES AS T4 ON T3.ATT_CLASS_ID = T4.ATT_CLASS_ID WHERE T2.OBJ_CLASS = 'van' AND T1.IMG_ID = 1 GROUP BY T4.ATT_CLASS",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T4.ATT_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID INNER JOIN IMG_OBJ_ATT AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN ATT_CLASSES AS T4 ON T3.ATT_CLASS_ID = T4.ATT_CLASS_ID WHERE T2.OBJ_CLASS = 'van' AND T1.IMG_ID = 1 GROUP BY T4.ATT_CLASS",
"index": 3545,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['can', 'van', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['spotted', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncolour refers to ATT_CLASS; van refers to OBJ_CLASS = 'van'; image no. 1 refers to IMG_ID = 1\nWhat colour is the van that can be spotted in image 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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\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 attributes refers to ATT_CLASS_ID; object sample no. 7 on image no. 4 refers to IMG_ID = 4 and OBJ_SAMPLE_ID = 7\nHow many attributes are related to the object sample no. 7 on image no. 4?\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(ATT_CLASS_ID) FROM IMG_OBJ_ATT WHERE IMG_ID = 4 AND OBJ_SAMPLE_ID = 7",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(ATT_CLASS_ID) FROM IMG_OBJ_ATT WHERE IMG_ID = 4 AND OBJ_SAMPLE_ID = 7",
"index": 3546,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\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 attributes refers to ATT_CLASS_ID; object sample no. 7 on image no. 4 refers to IMG_ID = 4 and OBJ_SAMPLE_ID = 7\nHow many attributes are related to the object sample no. 7 on image no. 4?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['number', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimage no. 20 refers to IMG_ID = 20; attribute ID refers to ATT_CLASS_ID; highest number of objects refers to max(count(ATT_CLASS_ID))\nOn image no. 20, identify the attribute ID that is composed of the highest number of objects.\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 ATT_CLASS_ID FROM IMG_OBJ_ATT WHERE IMG_ID = 20 GROUP BY ATT_CLASS_ID ORDER BY COUNT(ATT_CLASS_ID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT ATT_CLASS_ID FROM IMG_OBJ_ATT WHERE IMG_ID = 20 GROUP BY ATT_CLASS_ID ORDER BY COUNT(ATT_CLASS_ID) DESC LIMIT 1",
"index": 3547,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['number', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'numbers', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimage no. 20 refers to IMG_ID = 20; attribute ID refers to ATT_CLASS_ID; highest number of objects refers to max(count(ATT_CLASS_ID))\nOn image no. 20, identify the attribute ID that is composed of the highest number of objects.\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute classes refer to ATT_CLASS_ID; image id 5 refers to IMG_ID = 5;\nHow many attribute classes are there for image id 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 COUNT(ATT_CLASS_ID) FROM IMG_OBJ_ATT WHERE IMG_ID = 5",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(ATT_CLASS_ID) FROM IMG_OBJ_ATT WHERE IMG_ID = 5",
"index": 3548,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute classes refer to ATT_CLASS_ID; image id 5 refers to IMG_ID = 5;\nHow many attribute classes are there for image id 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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncaption for the prediction class id 12 refers to PRED_CLASS where PRED_CLASS_ID = 12;\nWhat is the caption for the prediction class id 12?\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 PRED_CLASS FROM PRED_CLASSES WHERE PRED_CLASS_ID = 12",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT PRED_CLASS FROM PRED_CLASSES WHERE PRED_CLASS_ID = 12",
"index": 3549,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncaption for the prediction class id 12 refers to PRED_CLASS where PRED_CLASS_ID = 12;\nWhat is the caption for the prediction class id 12?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'tip', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples in the class of \"tip\" refer to OBJ_CLASS_ID where OBJ_CLASS = 'tip'; image no.5 refers to IMG_ID = 5;\nHow many object samples in image no.908 are in the class of tip?\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 T2.OBJ_CLASS = 'tip' THEN 1 ELSE 0 END) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 908",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.OBJ_CLASS = 'tip' THEN 1 ELSE 0 END) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 908",
"index": 3550,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'tip', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject samples in the class of \"tip\" refer to OBJ_CLASS_ID where OBJ_CLASS = 'tip'; image no.5 refers to IMG_ID = 5;\nHow many object samples in image no.908 are in the class of tip?\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'onion', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nonion category refers to OBJ_CLASS = 'onion';\nWhich object classes belong to the onion category?\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 OBJ_CLASS_ID FROM OBJ_CLASSES WHERE OBJ_CLASS = 'onion'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT OBJ_CLASS_ID FROM OBJ_CLASSES WHERE OBJ_CLASS = 'onion'",
"index": 3551,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'onion', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nonion category refers to OBJ_CLASS = 'onion';\nWhich object classes belong to the onion category?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['from', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['spoon', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe bounding box refers to X, Y, W, H from IMG_OBJ; image id 1344 refers to IMG_ID = 1344; \"spoon\" refers to OBJ_CLASS = 'spoon';\nWhat is the bounding box of \"spoon\" in image id 1344?\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.X, T1.Y, T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 1344 AND T2.OBJ_CLASS = 'spoon'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.X, T1.Y, T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 1344 AND T2.OBJ_CLASS = 'spoon'",
"index": 3552,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['from', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['spoon', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe bounding box refers to X, Y, W, H from IMG_OBJ; image id 1344 refers to IMG_ID = 1344; \"spoon\" refers to OBJ_CLASS = 'spoon';\nWhat is the bounding box of \"spoon\" in image id 1344?\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding box refers to X, Y, W, H from IMG_OBJ; tallest relates to the height of the bounding box which refers to MAX(H); object class refers to OBJ_CLASS;\nState the object class of the image with tallest bounding box.\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.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID ORDER BY T1.H DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID ORDER BY T1.H DESC LIMIT 1",
"index": 3553,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding box refers to X, Y, W, H from IMG_OBJ; tallest relates to the height of the bounding box which refers to MAX(H); object class refers to OBJ_CLASS;\nState the object class of the image with tallest bounding box.\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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'animal', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['animal', 'many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsamples of animal objects refer to OBJ_SAMPLE_ID where OBJ_CLASS = 'animal'; image no.660 refers to IMG_ID = 660;\nHow many samples of animal objects are there in image no.660?\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.IMG_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'animal' AND T1.IMG_ID = 660",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(T1.IMG_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'animal' AND T1.IMG_ID = 660",
"index": 3554,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'animal', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['animal', 'many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsamples of animal objects refer to OBJ_SAMPLE_ID where OBJ_CLASS = 'animal'; image no.660 refers to IMG_ID = 660;\nHow many samples of animal objects are there in image no.660?\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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['from', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding box refers to X, Y, W, H from IMG_OBJ; lowest relates to the height of the bounding box which refers to MIN(H);\nName the object class of the image with lowest bounding box.\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.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID ORDER BY T1.H LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID ORDER BY T1.H LIMIT 1",
"index": 3555,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['from', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbounding box refers to X, Y, W, H from IMG_OBJ; lowest relates to the height of the bounding box which refers to MIN(H);\nName the object class of the image with lowest bounding box.\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwidest relates to the width of the bounding\nbox of the object which refers to MAX(W); object in image 8 refers to OBJ_SAMPLE_ID where IMG_ID = 8;\nWhich object in image 8 is the widest? State its object sample 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 OBJ_SAMPLE_ID FROM IMG_OBJ WHERE IMG_ID = 8 ORDER BY W DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT OBJ_SAMPLE_ID FROM IMG_OBJ WHERE IMG_ID = 8 ORDER BY W DESC LIMIT 1",
"index": 3556,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwidest relates to the width of the bounding\nbox of the object which refers to MAX(W); object in image 8 refers to OBJ_SAMPLE_ID where IMG_ID = 8;\nWhich object in image 8 is the widest? State its object sample 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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['number', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(OBJ_SAMPLE_ID where IMG_ID = 1), SUM(OBJ_SAMPLE_ID where IMG_ID = 6));\nWhat is the ratio between the number of object samples in image 1 and the number of object samples in image 6?\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 IMG_ID = 1 THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN IMG_ID = 6 THEN 1 ELSE 0 END) FROM IMG_OBJ",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN IMG_ID = 1 THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN IMG_ID = 6 THEN 1 ELSE 0 END) FROM IMG_OBJ",
"index": 3557,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['number', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(OBJ_SAMPLE_ID where IMG_ID = 1), SUM(OBJ_SAMPLE_ID where IMG_ID = 6));\nWhat is the ratio between the number of object samples in image 1 and the number of object samples in image 6?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OBJ_SAMPLE_ID), COUNT(IMG_ID));\nCalculate the average of object samples for the image.\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(COUNT(OBJ_SAMPLE_ID) AS REAL) / COUNT(DISTINCT IMG_ID) FROM IMG_OBJ",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT CAST(COUNT(OBJ_SAMPLE_ID) AS REAL) / COUNT(DISTINCT IMG_ID) FROM IMG_OBJ",
"index": 3558,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OBJ_SAMPLE_ID), COUNT(IMG_ID));\nCalculate the average of object samples for the image.\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['wired', 'wire', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'wire', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of images refer to IMG_ID; objects with the attributes of 'wired' refer to ATT_CLASS = 'wired';\nList all the IDs of images that have objects with the attributes of 'wired'.\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.IMG_ID FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.ATT_CLASS = 'wired'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT DISTINCT T2.IMG_ID FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.ATT_CLASS = 'wired'",
"index": 3559,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['wired', 'wire', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'wire', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIDs of images refer to IMG_ID; objects with the attributes of 'wired' refer to ATT_CLASS = 'wired';\nList all the IDs of images that have objects with the attributes of 'wired'.\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes refer to OBJ_CLASS; image 10 refers to IMG_ID = 10;\nList all the object classes in image 10.\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.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 10",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT DISTINCT T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 10",
"index": 3560,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes refer to OBJ_CLASS; image 10 refers to IMG_ID = 10;\nList all the object classes in image 10.\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'tip', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattributes for object refer to ATT_CLASS; class 'tip' in image 1314 refers to OBJ_CLASS = 'tip' where IMG_ID = 1314;\nList attributes for object class 'tip' In image 1314.\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.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T3.IMG_ID = 1314 AND T4.OBJ_CLASS = 'tip'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T3.IMG_ID = 1314 AND T4.OBJ_CLASS = 'tip'",
"index": 3561,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'tip', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattributes for object refer to ATT_CLASS; class 'tip' in image 1314 refers to OBJ_CLASS = 'tip' where IMG_ID = 1314;\nList attributes for object class 'tip' In image 1314.\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'label', 'chain', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprediction class refers to PRED_CLASS; object class 'chain' refers to OBJ_CLASS = 'chain'; object class 'label' refers to OBJ_CLASS = 'label'; image 2360078 refers to IMG_ID = 2360078;\nWhat is the prediction class between object class 'chain' and 'label' in image 2360078?\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.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T2.PRED_CLASS_ID = T1.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID AND T1.OBJ1_SAMPLE_ID = T3.OBJ_SAMPLE_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T1.IMG_ID = 2360078 AND T1.OBJ1_SAMPLE_ID = 15 OR T1.OBJ2_SAMPLE_ID = 18",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT DISTINCT T2.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T2.PRED_CLASS_ID = T1.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID AND T1.OBJ1_SAMPLE_ID = T3.OBJ_SAMPLE_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T1.IMG_ID = 2360078 AND T1.OBJ1_SAMPLE_ID = 15 OR T1.OBJ2_SAMPLE_ID = 18",
"index": 3562,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'label', 'chain', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['between', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprediction class refers to PRED_CLASS; object class 'chain' refers to OBJ_CLASS = 'chain'; object class 'label' refers to OBJ_CLASS = 'label'; image 2360078 refers to IMG_ID = 2360078;\nWhat is the prediction class between object class 'chain' and 'label' in image 2360078?\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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattributes refer to ATT_CLASS; the widest relates to the width of the bounding\nbox of the object which refers to MAX(W); image 400 refers to IMG_ID = 400;\nWhat are the attributes of the widest object in image 400?\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.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID WHERE T2.IMG_ID = 400 ORDER BY T3.W DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID WHERE T2.IMG_ID = 400 ORDER BY T3.W DESC LIMIT 1",
"index": 3563,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattributes refer to ATT_CLASS; the widest relates to the width of the bounding\nbox of the object which refers to MAX(W); image 400 refers to IMG_ID = 400;\nWhat are the attributes of the widest object in image 400?\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject class that has in most images refers to OBJ_CLASS where MAX(COUNT(OBJ_CLASS_ID));\nState the name of the object class that has in most images.\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 OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID GROUP BY T2.OBJ_CLASS ORDER BY COUNT(T1.OBJ_CLASS_ID) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID GROUP BY T2.OBJ_CLASS ORDER BY COUNT(T1.OBJ_CLASS_ID) DESC LIMIT 1",
"index": 3564,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject class that has in most images refers to OBJ_CLASS where MAX(COUNT(OBJ_CLASS_ID));\nState the name of the object class that has in most images.\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'stand', 'van', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe bounding box's W and H abbreviations stand for the object's width and height respectively; class of 'van' in image 1 refers to OBJ_CLASS = 'van' where IMG_ID = 1;\nState the width and height of the object with the class of 'van' in image 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.H, T1.W FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 1 AND T2.OBJ_CLASS = 'van'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.H, T1.W FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 1 AND T2.OBJ_CLASS = 'van'",
"index": 3565,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'stand', 'van', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe bounding box's W and H abbreviations stand for the object's width and height respectively; class of 'van' in image 1 refers to OBJ_CLASS = 'van' where IMG_ID = 1;\nState the width and height of the object with the class of 'van' in image 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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['street light', 'object', 'lights', 'street', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OBJ_SAMPLE_ID where OBJ_CLASS = 'street lights'), COUNT(OBJ_SAMPLE_ID)) as percentage;\nCalculate the percentage of object samples that are related to street lights.\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.OBJ_CLASS = 'street lights' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OBJ_SAMPLE_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.OBJ_CLASS = 'street lights' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OBJ_SAMPLE_ID) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID",
"index": 3566,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['street light', 'object', 'lights', 'street', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OBJ_SAMPLE_ID where OBJ_CLASS = 'street lights'), COUNT(OBJ_SAMPLE_ID)) as percentage;\nCalculate the percentage of object samples that are related to street lights.\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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['windows', 'object', 'base', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OBJ_SAMPLE_ID where OBJ_CLASS = 'windows' and IMG_ID = 5), COUNT(OBJ_SAMPLE_ID where IMG_ID = 5)) as percentage;\nBased on image 5, what is the percentage of images that belong windows object class?\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(COUNT(T1.OBJ_SAMPLE_ID) AS REAL) * 100 / COUNT(CASE WHEN T1.IMG_ID = 5 THEN 1 ELSE 0 END) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'windows'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT CAST(COUNT(T1.OBJ_SAMPLE_ID) AS REAL) * 100 / COUNT(CASE WHEN T1.IMG_ID = 5 THEN 1 ELSE 0 END) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'windows'",
"index": 3567,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['windows', 'object', 'base', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OBJ_SAMPLE_ID where OBJ_CLASS = 'windows' and IMG_ID = 5), COUNT(OBJ_SAMPLE_ID where IMG_ID = 5)) as percentage;\nBased on image 5, what is the percentage of images that belong windows object class?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nX and Y refer to coordinates of the bounding box where X = 5 and Y = 5; images refer to IMG_ID;\nHow many images have an x-coordinate of 5 and y-coordinate of 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 COUNT(IMG_ID) FROM IMG_OBJ WHERE X = 5 AND Y = 5",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(IMG_ID) FROM IMG_OBJ WHERE X = 5 AND Y = 5",
"index": 3568,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nX and Y refer to coordinates of the bounding box where X = 5 and Y = 5; images refer to IMG_ID;\nHow many images have an x-coordinate of 5 and y-coordinate of 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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimages refer to IMG_ID; less than 15 object samples refer to COUNT(OBJ_SAMPLE_ID) < 15;\nHow many images have less than 15 object samples?\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(IMG_ID) FROM IMG_OBJ WHERE OBJ_SAMPLE_ID < 15",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(IMG_ID) FROM IMG_OBJ WHERE OBJ_SAMPLE_ID < 15",
"index": 3569,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nimages refer to IMG_ID; less than 15 object samples refer to COUNT(OBJ_SAMPLE_ID) < 15;\nHow many images have less than 15 object samples?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['parked', 'park', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['parked on', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npredicted class of \"parked on\" refers to PRED_CLASS = 'parked on';\nWhat is the image ID with a predicted class of \"parked on\"?\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.IMG_ID FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.PRED_CLASS = 'parked on'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT DISTINCT T1.IMG_ID FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.PRED_CLASS = 'parked on'",
"index": 3570,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['parked', 'park', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['parked on', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npredicted class of \"parked on\" refers to PRED_CLASS = 'parked on';\nWhat is the image ID with a predicted class of \"parked on\"?\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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes refer to OBJ_CLASS; (5,5) coordinates refer to X and Y coordinates of the bounding box where X = 5 and Y = 5;\nList all the object classes of the images that have a (5,5) coordinate.\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.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.X = 5 AND T1.Y = 5",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.X = 5 AND T1.Y = 5",
"index": 3571,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes refer to OBJ_CLASS; (5,5) coordinates refer to X and Y coordinates of the bounding box where X = 5 and Y = 5;\nList all the object classes of the images that have a (5,5) coordinate.\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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['keyboard', 'object', 'stand', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe bounding box's W and H abbreviations stand for the object's width and height respectively; \"keyboard\" as object class refers to OBJ_CLASS = 'keyboard'; (5, 647) as coordinate refers to X and Y coordinates of the bounding box where X = 5 and Y = 647;\nWhat are the width and height of the bounding box of the object with \"keyboard\" as their object class and (5, 647) as their coordinate?\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.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'keyboard' AND T1.X = 5 AND T1.Y = 647",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'keyboard' AND T1.X = 5 AND T1.Y = 647",
"index": 3572,
"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 IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['keyboard', 'object', 'stand', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe bounding box's W and H abbreviations stand for the object's width and height respectively; \"keyboard\" as object class refers to OBJ_CLASS = 'keyboard'; (5, 647) as coordinate refers to X and Y coordinates of the bounding box where X = 5 and Y = 647;\nWhat are the width and height of the bounding box of the object with \"keyboard\" as their object class and (5, 647) as their coordinate?\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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['horse', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID of all images refer to IMG_ID; attribute class of \"horse\" refers to ATT_CLASS = 'horse';\nList all the ID of the images that have an attribute class of \"horse\".\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.IMG_ID FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.ATT_CLASS = 'horse'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.IMG_ID FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.ATT_CLASS = 'horse'",
"index": 3573,
"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 ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['horse', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nID of all images refer to IMG_ID; attribute class of \"horse\" refers to ATT_CLASS = 'horse';\nList all the ID of the images that have an attribute class of \"horse\".\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute classes of the image ID \"15\" refer to ATT_CLASS where IMG_ID = 15;\nList all the attribute classes of the image ID \"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 T1.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 15",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 15",
"index": 3574,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute classes of the image ID \"15\" refer to ATT_CLASS where IMG_ID = 15;\nList all the attribute classes of the image ID \"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['picture', 'object', 'bear', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['picture', 'many', 'bear', 'pictured', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"picture\" as attribute class refers to ATT_CLASS = 'picture'; \"bear\" as object class refers to OBJ_CLASS = 'bear'; images refer to IMG_ID;\nHow many images have \"picture\" as their attribute class and \"bear\" as their object class?\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.IMG_ID) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T1.ATT_CLASS = 'picture' AND T4.OBJ_CLASS = 'bear'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(T2.IMG_ID) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T1.ATT_CLASS = 'picture' AND T4.OBJ_CLASS = 'bear'",
"index": 3575,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['picture', 'object', 'bear', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['picture', 'many', 'bear', 'pictured', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"picture\" as attribute class refers to ATT_CLASS = 'picture'; \"bear\" as object class refers to OBJ_CLASS = 'bear'; images refer to IMG_ID;\nHow many images have \"picture\" as their attribute class and \"bear\" as their object class?\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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject sample ID refers to OBJ_SAMPLE_ID; image ID 17 refers to IMG_ID = 17; coordinates (0,0) refer to X and Y coordinates of the bounding box where X = 0 and Y = 0;\nList the object sample IDs of image ID 17 with coordinates (0,0).\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 OBJ_SAMPLE_ID FROM IMG_OBJ WHERE IMG_ID = 17 AND X = 0 AND Y = 0",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT OBJ_SAMPLE_ID FROM IMG_OBJ WHERE IMG_ID = 17 AND X = 0 AND Y = 0",
"index": 3576,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject sample ID refers to OBJ_SAMPLE_ID; image ID 17 refers to IMG_ID = 17; coordinates (0,0) refer to X and Y coordinates of the bounding box where X = 0 and Y = 0;\nList the object sample IDs of image ID 17 with coordinates (0,0).\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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nY coordinate many are 0 refers to Y coordinates of the bounding box where Y = 0; image ID 12 refers to IMG_ID = 12;\nIn the Y coordinate of image ID 12, how many are 0?\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(IMG_ID) FROM IMG_OBJ WHERE IMG_ID = 12 AND Y = 0",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(IMG_ID) FROM IMG_OBJ WHERE IMG_ID = 12 AND Y = 0",
"index": 3577,
"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 OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nY coordinate many are 0 refers to Y coordinates of the bounding box where Y = 0; image ID 12 refers to IMG_ID = 12;\nIn the Y coordinate of image ID 12, how many are 0?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute classes of image ID 22 refer to ATT_CLASS where MG_ID = 22;\nList all the attribute classes of image ID 22.\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.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 22",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.ATT_CLASS FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 22",
"index": 3578,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute classes of image ID 22 refer to ATT_CLASS where MG_ID = 22;\nList all the attribute classes of image ID 22.\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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject class refers to OBJ_CLASS; X and Y coordinates of 126 and 363 refer to coordinates of the bounding box where X = 126 and Y = 363;\nWhat object class is in the X and Y coordinates of 126 and 363?\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.IMG_ID, T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.X = 126 AND T1.Y = 363",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.IMG_ID, T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.X = 126 AND T1.Y = 363",
"index": 3579,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject class refers to OBJ_CLASS; X and Y coordinates of 126 and 363 refer to coordinates of the bounding box where X = 126 and Y = 363;\nWhat object class is in the X and Y coordinates of 126 and 363?\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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes of image ID 22 refers to OBJ_CLASS where IMG_ID = 22; the object's width and heigh refer to W and H coordinates of the bounding box respectively;\nWrite the object classes of image ID 22 alongside the object's width and height.\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.W, T1.H, T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 22",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T1.W, T1.H, T2.OBJ_CLASS FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 22",
"index": 3580,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nobject classes of image ID 22 refers to OBJ_CLASS where IMG_ID = 22; the object's width and heigh refer to W and H coordinates of the bounding box respectively;\nWrite the object classes of image ID 22 alongside the object's width and height.\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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npredicate class of image ID 68 refers to PRED_CLASS where IMG_ID = 68;\nWhat is the predicate class of image ID 68?\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.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.IMG_ID = 68",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.IMG_ID = 68",
"index": 3581,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npredicate class of image ID 68 refers to PRED_CLASS where IMG_ID = 68;\nWhat is the predicate class of image ID 68?\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'has', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas' predicate classes refers to PRED_CLASS = 'has'; image ID 107 refers to IMG_ID = 107;\nHow many 'has' predicate classes does image ID 107 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.PRED_CLASS) FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.IMG_ID = 107 AND T2.PRED_CLASS = 'has'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(T2.PRED_CLASS) FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.IMG_ID = 107 AND T2.PRED_CLASS = 'has'",
"index": 3582,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['have', 'has', 'playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas' predicate classes refers to PRED_CLASS = 'has'; image ID 107 refers to IMG_ID = 107;\nHow many 'has' predicate classes does image ID 107 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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common predicate class of image ID 4434 MAX(PRED_CLASS) where IMG_ID = 4434;\nName the most common predicate class of image ID 4434.\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.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.IMG_ID = 4434 ORDER BY T2.PRED_CLASS DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.PRED_CLASS FROM IMG_REL AS T1 INNER JOIN PRED_CLASSES AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.IMG_ID = 4434 ORDER BY T2.PRED_CLASS DESC LIMIT 1",
"index": 3583,
"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 IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common predicate class of image ID 4434 MAX(PRED_CLASS) where IMG_ID = 4434;\nName the most common predicate class of image ID 4434.\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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'blue', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblue' attribute classes on image ID 2355735 refer to ATT_CLASS = 'blue' where IMG_ID = 2355735;\nHow many 'blue' attribute classes are there on image ID 2355735?\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.ATT_CLASS) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 2355735 AND T1.ATT_CLASS = 'blue'",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT COUNT(T1.ATT_CLASS) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 2355735 AND T1.ATT_CLASS = 'blue'",
"index": 3584,
"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 IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n ATT_CLASS text, -- ATTRIBUTE CLASS, example: ['many', 'blue', 'building s', 'indoors']\n PRIMARY KEY (ATT_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nblue' attribute classes on image ID 2355735 refer to ATT_CLASS = 'blue' where IMG_ID = 2355735;\nHow many 'blue' attribute classes are there on image ID 2355735?\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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'stand', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe bounding box's W and H abbreviations stand for the object's width and height in which average width and height refer to AVG(W) and AVG(H) respectively; image ID 47 refers to IMG_ID = 47; object classes refer to OBJ_CLASS;\nWhat is the average width and height of the objects in image ID 47? List their object classes as well.\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.OBJ_CLASS, AVG(T1.W), AVG(T1.H) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 47 GROUP BY T2.OBJ_CLASS",
"style": "rule"
} | {
"db_id": "image_and_language.sqlite",
"gt_sql": "SELECT T2.OBJ_CLASS, AVG(T1.W), AVG(T1.H) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 47 GROUP BY T2.OBJ_CLASS",
"index": 3585,
"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 PRED_CLASSES (\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n PRED_CLASS text, -- PREDICTION CLASS, example: ['playing on', 'looking a']\n PRIMARY KEY (PRED_CLASS_ID)\n);\n\nCREATE TABLE IMG_OBJ_ATT (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [21, 22]\n PRIMARY KEY (IMG_ID, ATT_CLASS_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_att_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_obj_att_att_class_id FOREIGN KEY (ATT_CLASS_ID) REFERENCES ATT_CLASSES (ATT_CLASS_ID),\n CONSTRAINT fk_img_obj_att_obj_sample_id FOREIGN KEY (OBJ_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_REL (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n PRED_CLASS_ID integer, -- PREDICTION CLASS ID, example: [0, 1]\n OBJ1_SAMPLE_ID integer, -- OBJECT1 SAMPLE ID, example: [13, 12]\n OBJ2_SAMPLE_ID integer, -- OBJECT2 SAMPLE ID, example: [1, 34]\n PRIMARY KEY (IMG_ID, PRED_CLASS_ID, OBJ1_SAMPLE_ID, OBJ2_SAMPLE_ID),\n CONSTRAINT fk_img_rel_img_id FOREIGN KEY (IMG_ID) REFERENCES IMG_OBJ (IMG_ID),\n CONSTRAINT fk_img_rel_pred_class_id FOREIGN KEY (PRED_CLASS_ID) REFERENCES PRED_CLASSES (PRED_CLASS_ID),\n CONSTRAINT fk_img_rel_obj1_sample_id FOREIGN KEY (OBJ1_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_rel_obj2_sample_id FOREIGN KEY (OBJ2_SAMPLE_ID) REFERENCES IMG_OBJ (OBJ_SAMPLE_ID)\n);\n\nCREATE TABLE IMG_OBJ (\n IMG_ID integer, -- IMAGE ID, example: [1, 2]\n OBJ_SAMPLE_ID integer, -- OBJECT SAMPLE ID, example: [1, 2]\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [298, 246]\n X integer, -- example: [0, 78]\n Y integer, -- example: [0, 308]\n W integer, -- example: [799, 722]\n H integer, -- example: [557, 290]\n PRIMARY KEY (IMG_ID, OBJ_SAMPLE_ID),\n CONSTRAINT fk_img_obj_obj_class_id FOREIGN KEY (OBJ_CLASS_ID) REFERENCES OBJ_CLASSES (OBJ_CLASS_ID)\n);\n\nCREATE TABLE OBJ_CLASSES (\n OBJ_CLASS_ID integer, -- OBJECT CLASS ID, example: [0, 1]\n OBJ_CLASS text, -- OBJECT CLASS, example: ['object', 'stand', 'box', 'awning', 'goggles']\n PRIMARY KEY (OBJ_CLASS_ID)\n);\n\nCREATE TABLE ATT_CLASSES (\n ATT_CLASS_ID integer, -- ATTRIBUTE CLASS ID, example: [0, 1]\n PRIMARY KEY (ATT_CLASS_ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe bounding box's W and H abbreviations stand for the object's width and height in which average width and height refer to AVG(W) and AVG(H) respectively; image ID 47 refers to IMG_ID = 47; object classes refer to OBJ_CLASS;\nWhat is the average width and height of the objects in image ID 47? List their object classes as well.\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['USA', 'Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNot from USA refers to birthCountry! = 'USA'; born in 1990 refers to birthYear = 1990\n\nList the first Name and last name of all players not from USA and who are born in 1990 .\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, lastName FROM Master WHERE birthYear = 1990 AND birthCountry != 'USA'",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT firstName, lastName FROM Master WHERE birthYear = 1990 AND birthCountry != 'USA'",
"index": 3586,
"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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['USA', 'Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNot from USA refers to birthCountry! = 'USA'; born in 1990 refers to birthYear = 1990\n\nList the first Name and last name of all players not from USA and who are born in 1990 .\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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['More', 'Aalto', 'Abbey']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n SepL text, -- September loses, example: ['1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n MarT text, -- March ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoalie who played for more than 2 teams refers to COUNT(DISTINCT(T2.tmID))>2\nName the goalies who played for more than two teams from Year 2000 to 2005.\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.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year >= 2000 AND T2.year <= 2005 GROUP BY T2.playerID HAVING COUNT(DISTINCT T2.tmID) > 2",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year >= 2000 AND T2.year <= 2005 GROUP BY T2.playerID HAVING COUNT(DISTINCT T2.tmID) > 2",
"index": 3587,
"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 AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['More', 'Aalto', 'Abbey']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathDay text, -- example: ['1', '7']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n SepL text, -- September loses, example: ['1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n MarT text, -- March ties, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoalie who played for more than 2 teams refers to COUNT(DISTINCT(T2.tmID))>2\nName the goalies who played for more than two teams from Year 2000 to 2005.\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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Weight', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage weight refers to AVG(weight); height greater than 72 inches refers to height>72\nWhat is the average weight of players who have height greater than 72 inches.\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 AVG(weight) FROM Master WHERE height > 72",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT AVG(weight) FROM Master WHERE height > 72",
"index": 3588,
"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 abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Weight', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage weight refers to AVG(weight); height greater than 72 inches refers to height>72\nWhat is the average weight of players who have height greater than 72 inches.\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 Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed more than total of 5000 minutes refers to SUM(Min)>5000;country he was born refers to birthCountry\n\nName the goalies who have played more than total of 5000 minutes in the all the season played. State given name of the player and from which country was he born.\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.nameGiven, T1.birthCountry FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID GROUP BY T1.nameGiven, T1.birthCountry HAVING SUM(T2.Min) > 5000",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT DISTINCT T1.nameGiven, T1.birthCountry FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID GROUP BY T1.nameGiven, T1.birthCountry HAVING SUM(T2.Min) > 5000",
"index": 3589,
"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 Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE CombinedShutouts (\n `date` integer, -- example: [14, 15]\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n MarT text, -- March ties, example: ['0', '1']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed more than total of 5000 minutes refers to SUM(Min)>5000;country he was born refers to birthCountry\n\nName the goalies who have played more than total of 5000 minutes in the all the season played. State given name of the player and from which country was he born.\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 Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n deathYear text, -- example: ['1964', '2000']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndeceased refers to deathYear; most time played refers to MAX(Min)\nList all deceased goalies by last name. List the season where he had the most time played.\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.playerID, T2.year, Min FROM Master AS T1 INNER JOIN Goalies AS T2 ON T2.playerID = T1.playerID WHERE T1.deathYear IS NOT NULL ORDER BY T2.Min DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT T1.playerID, T2.year, Min FROM Master AS T1 INNER JOIN Goalies AS T2 ON T2.playerID = T1.playerID WHERE T1.deathYear IS NOT NULL ORDER BY T2.Min DESC LIMIT 1",
"index": 3590,
"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 Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Max', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Max', 'Preacher', 'Taffy']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n deathYear text, -- example: ['1964', '2000']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndeceased refers to deathYear; most time played refers to MAX(Min)\nList all deceased goalies by last name. List the season where he had the most time played.\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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['COL', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['COL', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['COL', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['COL', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['COL', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COL', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Weight', 'Given', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam COL refers to tmID = 'COL'; age of today refers to SUBTRACT(YEAR(NOW())-birthYear)\nList all goalies from year 2000 to 2010 for team COL. State their given name, height, weight and age of today.\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.nameGiven, T1.height , T1.weight, STRFTIME('%Y', CURRENT_TIMESTAMP) - birthYear FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'COL' AND T2.year >= 2000 AND T2.year <= 2010 GROUP BY T1.playerID",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT T1.nameGiven, T1.height , T1.weight, STRFTIME('%Y', CURRENT_TIMESTAMP) - birthYear FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'COL' AND T2.year >= 2000 AND T2.year <= 2010 GROUP BY T1.playerID",
"index": 3591,
"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 GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['COL', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['COL', 'CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['COL', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['COL', 'QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['COL', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPA text, -- Power play assists, example: ['0', '1']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COL', 'COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepOL text, -- September overtime loses, example: ['0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Weight', 'Given', 'Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathDay text, -- example: ['1', '7']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nteam COL refers to tmID = 'COL'; age of today refers to SUBTRACT(YEAR(NOW())-birthYear)\nList all goalies from year 2000 to 2010 for team COL. State their given name, height, weight and age of today.\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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['More', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10 or more empty net goals refers to ENG> = 10; season refers to year\nName all goalies with 10 or more empty net goals. Name the players and season where he played.\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.firstName, T1.lastName , T2.year FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.ENG >= 10",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT T1.firstName, T1.lastName , T2.year FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.ENG >= 10",
"index": 3592,
"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 AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hT integer, -- home ties, example: [0, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepT text, -- September ties\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['More', 'Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10 or more empty net goals refers to ENG> = 10; season refers to year\nName all goalies with 10 or more empty net goals. Name the players and season where he played.\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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshorter than 72 inches refers to height<72\nList all goalies who played in the year 2005 season and shorter than 72 inches. List all the team names he play for.\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.firstName, T1.lastName, T3.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.tmID = T3.tmID WHERE T2.year = 2005 AND T1.height < 72",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT DISTINCT T1.firstName, T1.lastName, T3.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.tmID = T3.tmID WHERE T2.year = 2005 AND T1.height < 72",
"index": 3593,
"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 TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n postt text, -- post-season ties, example: ['0', '1']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GF integer, -- Goals for, example: [79, 77]\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n PPC text, -- Power play chances, example: ['220', '279']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n PIM text, -- penalty minutes, example: ['59', '68']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n birthYear text, -- example: ['1975', '1951']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthState text, -- example: ['ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n FebW integer, -- February wins, example: [2, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n PPG text, -- Power play goals, example: ['0', '2']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshorter than 72 inches refers to height<72\nList all goalies who played in the year 2005 season and shorter than 72 inches. List all the team names he play for.\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 TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aubinje01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['aubinje01', 'abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aubinje01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Nick', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Nick', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aubinje01', 'aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n pos text, -- position, example: ['C', 'D']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aubinje01', 'aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnick name refers to nameNick; team refers to tmID; season refers to year\n\n\nState the nick name of player ID 'aubinje01'. List all the teams and season he played for.\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.nameNick, T3.year, T3.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.tmID = T3.tmID WHERE T1.playerID = 'aubinje01'",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT DISTINCT T1.nameNick, T3.year, T3.name FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.tmID = T3.tmID WHERE T1.playerID = 'aubinje01'",
"index": 3594,
"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 TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aubinje01', 'aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n GWG text, -- Game-winning goals, example: ['0', '1']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['aubinje01', 'abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebT integer, -- February ties, example: [0, 1]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarW text, -- March wins, example: ['1', '3']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aubinje01', 'aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Nick', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Nick', 'Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['Preacher', 'Taffy']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aubinje01', 'aaltoan01', 'abbeybr01']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n pos text, -- position, example: ['C', 'D']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ID', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathYear text, -- example: ['1964', '2000']\n deathMon text, -- death month, example: ['8', '2']\n deathDay text, -- example: ['1', '7']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aubinje01', 'aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PPC text, -- Power play chances, example: ['39', '27']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnick name refers to nameNick; team refers to tmID; season refers to year\n\n\nState the nick name of player ID 'aubinje01'. List all the teams and season he played for.\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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n OctW text, -- October wins, example: ['0', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n shootCatch text, -- example: ['L', 'R']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost seasons played refers to MAX(COUNT(playerID)); average time he played for each season refers to DIVIDE(SUM(T2.Min),COUNT(T2.playerID))\nName the goalies with the most seasons played. State the average time he played for each season.\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.firstName, T1.lastName, T2.year, AVG(T2.Min) FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.playerID = ( SELECT playerID FROM Goalies GROUP BY playerID ORDER BY COUNT(playerID) DESC LIMIT 1 ) GROUP BY T1.firstName, T1.lastName, T2.year",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT T1.firstName, T1.lastName, T2.year, AVG(T2.Min) FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T1.playerID = ( SELECT playerID FROM Goalies GROUP BY playerID ORDER BY COUNT(playerID) DESC LIMIT 1 ) GROUP BY T1.firstName, T1.lastName, T2.year",
"index": 3595,
"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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['MIN', 'BOS', 'NEW']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['MIN', 'ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PPG text, -- Power play goals, example: ['0', '2']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostA text, -- Postseason assists, example: ['0', '1']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [12, 16]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['MIN', 'PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['MIN', 'CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['MIN', 'VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['MIN', 'QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n Pts integer, -- points, example: [8, 4]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['MIN', 'COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n OctW text, -- October wins, example: ['0', '1']\n NovT text, -- November ties, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanT integer, -- January ties, example: [0, 1]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Max', 'Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n shootCatch text, -- example: ['L', 'R']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['MIN', 'COB', 'HAI']\n oppID text, -- opponent ID, example: ['MIN', 'HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost seasons played refers to MAX(COUNT(playerID)); average time he played for each season refers to DIVIDE(SUM(T2.Min),COUNT(T2.playerID))\nName the goalies with the most seasons played. State the average time he played for each season.\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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthState text, -- example: ['GA', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['GA', 'MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n OctT text, -- October ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshutouts refers to SHO; number of goals refers to GA; 5% shutouts among the number of goals refers to DIVIDE(SHO,GA)*100 = 5.00\nName the goalie and the season he played where he had 5% shutouts among the number of goals recorded while the goalie was on the ice.\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.firstName, T1.lastName, T2.year FROM Master AS T1 INNER JOIN ( SELECT playerID, year FROM Goalies WHERE CAST(SHO AS REAL) / GA > 0.05 ) AS T2 ON T2.playerID = T1.playerID",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT DISTINCT T1.firstName, T1.lastName, T2.year FROM Master AS T1 INNER JOIN ( SELECT playerID, year FROM Goalies WHERE CAST(SHO AS REAL) / GA > 0.05 ) AS T2 ON T2.playerID = T1.playerID",
"index": 3596,
"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 SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPG text, -- Power play goals, example: ['1', '5']\n PKG text, -- Power play goals against, example: ['3', '8']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n rank integer, -- example: [4, 5]\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n SoW text, -- Shootout wins, example: ['3', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PPG text, -- Power play goals, example: ['28', '51']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n pos text, -- position, example: ['C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n hofID text, -- example: ['abelsi01h', 'adamsch01h']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameGiven text, -- example: ['Antti', 'Bruce']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n lastWHA text, -- Last WHA season, example: ['1975', '1977']\n pos text, -- position, example: ['C', 'D']\n birthState text, -- example: ['GA', 'ON', 'MB']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathMon text, -- death month, example: ['8', '2']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['GA', 'MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n stint integer, -- example: [1, 2]\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hL integer, -- home loses, example: [4, 3]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rT integer, -- Road ties, example: [0, 1]\n OctT text, -- October ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n MarW text, -- March wins, example: ['1', '3']\n MarL text, -- March loses, example: ['4', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshutouts refers to SHO; number of goals refers to GA; 5% shutouts among the number of goals refers to DIVIDE(SHO,GA)*100 = 5.00\nName the goalie and the season he played where he had 5% shutouts among the number of goals recorded while the goalie was on the ice.\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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage height refers to AVG(height); born in 1990 refers to birthYear = 1990\n\nWhat is the average height of player who were born in 1990 and after? Compare the average height with players who were born before 1990.\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 AVG(IIF(birthYear < 1990, height, NULL)) - AVG(IIF(birthYear >= 1990, height, NULL)) FROM Master",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT AVG(IIF(birthYear < 1990, height, NULL)) - AVG(IIF(birthYear >= 1990, height, NULL)) FROM Master",
"index": 3597,
"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 TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n GA integer, -- goals against, example: [38, 42]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n stint integer, -- example: [1, 2]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rT integer, -- Road ties, example: [0, 1]\n SepW text, -- September wins, example: ['1']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n JanT integer, -- January ties, example: [0, 1]\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprL text, -- April loses, example: ['0', '2']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPG text, -- Power play goals, example: ['28', '51']\n PPC text, -- Power play chances, example: ['220', '279']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n PIM integer, -- Penalty minutes, example: [0, 6]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n legendsID text, -- example: ['14862', '18411']\n hrefID text, -- Hockey-Reference.com ID, example: ['aaltoan01', 'abbeybr01']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n lastNHL text, -- Last NHL season, example: ['2000', '1943']\n firstWHA text, -- First WHA season, example: ['1975', '1976']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthCountry text, -- example: ['Finland', 'Canada']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathCity text, -- example: ['Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostENG text, -- Postseason empty net goals, example: ['0', '1']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n `R/P` text, -- regular / postseason, example: ['R', 'P']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [16, 12]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n `year` integer, -- example: [2001, 1998]\n note text, -- example: ['posthumous']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n SA integer, -- Shots against, example: [10, 18]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage height refers to AVG(height); born in 1990 refers to birthYear = 1990\n\nWhat is the average height of player who were born in 1990 and after? Compare the average height with players who were born before 1990.\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 HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['G', 'L', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['G', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['G', 'L', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'L', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['G', 'L', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngood at left hand refers to shootCatch = 'L'; goalies refers to pos = 'G'\nName the goalies who are good at left hand and also has become a coach after retirement. Name all teams he had played before.\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 firstName, lastName, T3.name FROM Goalies AS T1 INNER JOIN Master AS T2 ON T2.playerID = T1.playerID INNER JOIN Teams AS T3 ON T1.lgID = T3.lgID WHERE T1.playerID IS NOT NULL AND T2.coachID IS NOT NULL AND T2.shootCatch = 'L' AND T2.pos = 'G'",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT DISTINCT firstName, lastName, T3.name FROM Goalies AS T1 INNER JOIN Master AS T2 ON T2.playerID = T1.playerID INNER JOIN Teams AS T3 ON T1.lgID = T3.lgID WHERE T1.playerID IS NOT NULL AND T2.coachID IS NOT NULL AND T2.shootCatch = 'L' AND T2.pos = 'G'",
"index": 3598,
"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 HOF (\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postw text, -- post-season wins, example: ['3', '0']\n postl text, -- post-season loses, example: ['4', '5']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n award text, -- example: ['First Team All-Star', 'Second Team All-Star']\n `year` integer, -- example: [1930, 1931]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n lgID text, -- league ID, example: ['PCHA', 'WCHL']\n pos text, -- position, example: ['G', 'L', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `month` integer, -- example: [3, 2]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n PPA text, -- Power play assists, example: ['1', '5']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNick text, -- Nickname, example: ['G', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n weight text, -- example: ['210', '185']\n shootCatch text, -- example: ['L', 'R']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['G', 'L', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthMon text, -- birth Month, example: ['3', '8']\n birthDay text, -- example: ['4', '18']\n birthCity text, -- example: ['Lappeenranta', 'Toronto']\n deathDay text, -- example: ['1', '7']\n deathState text, -- example: ['MI', 'AB']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'L', 'C', 'D']\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n PIM integer, -- Penalty minutes, example: [0, 24]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n GTG text, -- Game-tying goals, example: ['0', '1']\n SOG text, -- Shots on goal, example: ['1', '61']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n `Post+/-` text, -- Postseason Plus / minus, example: ['0', '2']\n PostPPA text, -- Postseason power play assists, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSHA text, -- Postseason Shorthanded assists, example: ['0', '1']\n PostGWG text, -- Postseason game-winning goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n lgID text, -- league ID, example: ['NHL', 'WHA']\n note text, -- example: ['tie', 'shared']\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n confID text, -- Conference ID, example: ['CC', 'WA']\n divID text, -- Division ID, example: ['AM', 'CA']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n Pts integer, -- points, example: [8, 4]\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Cobalt Silver Kings', 'Haileybury Hockey Club']\n PIM text, -- Penalty minutes, example: ['336', '27']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n PKC text, -- Penalty kill chances, example: ['242', '301']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n `T/OL` text, -- Ties / overtime losses, example: ['0', '1']\n ENG text, -- Empty net goals, example: ['0', '1']\n SHO text, -- Shutouts, example: ['0', '1']\n SA text, -- Shots against, example: ['504', '1221']\n PostGP text, -- Postseason games played, example: ['1', '2']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostL text, -- Postseason loses, example: ['0', '1']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostSHO text, -- Postseason Shutouts, example: ['0', '1']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n hOTL text, -- Home overtime losses, example: ['2', '3']\n rL integer, -- Road loses, example: [4, 5]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovW text, -- November wins, example: ['5', '1']\n NovL text, -- November loses, example: ['1', '4']\n NovT text, -- November ties, example: ['0', '1']\n NovOL text, -- November overtime loses, example: ['0', '2']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecT text, -- December ties, example: ['0', '1']\n JanW integer, -- January wins, example: [1, 0]\n JanL integer, -- January loses, example: [1, 3]\n FebW integer, -- February wins, example: [2, 1]\n FebL integer, -- February loses, example: [3, 5]\n MarW text, -- March wins, example: ['1', '3']\n MarT text, -- March ties, example: ['0', '1']\n AprW text, -- April wins, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n series text, -- example: ['G', 'L', 'A', 'B']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n lgIDLoser text, -- league id of loser, example: ['NHA', 'PCHA']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n PPC text, -- Power play chances, example: ['39', '27']\n SHA text, -- Shorthanded goals against, example: ['0', '1']\n PKG text, -- Power play goals against, example: ['3', '8']\n SHF text, -- Shorthanded goals for, example: ['0', '1']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n GA integer, -- Goals against, example: [2, 6]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngood at left hand refers to shootCatch = 'L'; goalies refers to pos = 'G'\nName the goalies who are good at left hand and also has become a coach after retirement. Name all teams he had played before.\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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['G', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['G', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Boston', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Boston Bruins', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoalies refers to pos = 'G'; season refers to year\n\nName the goalies and season they played when Boston Bruins won number 1 in rank.\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.firstName, T1.lastName, T3.year FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.year = T3.year AND T2.tmID = T3.tmID WHERE T1.deathYear IS NOT NULL AND T3.name = 'Boston Bruins' AND T3.rank = 1 AND T1.pos = 'G'",
"style": "rule"
} | {
"db_id": "hockey.sqlite",
"gt_sql": "SELECT T1.firstName, T1.lastName, T3.year FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID INNER JOIN Teams AS T3 ON T2.year = T3.year AND T2.tmID = T3.tmID WHERE T1.deathYear IS NOT NULL AND T3.name = 'Boston Bruins' AND T3.rank = 1 AND T1.pos = 'G'",
"index": 3599,
"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 AwardsCoaches (\n coachID text, -- example: ['patrile01c', 'irvindi01c']\n `year` integer, -- example: [1930, 1931]\n note text,\n CONSTRAINT fk_awardscoaches_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE Goalies (\n playerID text, -- example: ['abbotge01', 'abrahch01']\n `year` integer, -- example: [1943, 1974]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['BOS', 'NEW']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n GP text, -- Games played, example: ['1', '16']\n `Min` text, -- Minutes, example: ['60', '870']\n W text, -- wins, example: ['0', '8']\n L text, -- loses, example: ['1', '6']\n SHO text, -- Shutouts, example: ['0', '1']\n GA text, -- Goals against, example: ['7', '47']\n PostMin text, -- Postseason minutes, example: ['1', '90']\n PostW text, -- Postseason wins, example: ['0', '6']\n PostT text, -- Postseason ties, example: ['1', '0']\n PostGA text, -- Postseason Goals against, example: ['0', '5']\n PostSA text, -- Postseason Shots against, example: ['51', '0']\n PRIMARY KEY (playerID, `year`, stint),\n CONSTRAINT fk_goalies_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goalies_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goalies_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Scoring (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n `year` integer, -- example: [1997, 1998]\n tmID text, -- team id, example: ['ANA', 'CIN']\n lgID text, -- league id, example: ['NHL', 'WHA']\n pos text, -- position, example: ['G', 'C', 'D']\n GP integer, -- game played, example: [3, 73]\n G integer, -- goals, example: [0, 3]\n A integer, -- assists, example: [0, 5]\n Pts integer, -- points, example: [0, 8]\n `+/-` text, -- Plus / minus, example: ['-1', '-12']\n PPG text, -- Power play goals, example: ['0', '2']\n PPA text, -- Power play assists, example: ['0', '1']\n SHG text, -- Shorthanded goals, example: ['0', '2']\n SHA text, -- Shorthanded assists, example: ['0', '1']\n GWG text, -- Game-winning goals, example: ['0', '1']\n PostGP text, -- Postseason games played, example: ['4', '10']\n PostG text, -- Postseason goals, example: ['0', '2']\n PostA text, -- Postseason assists, example: ['0', '1']\n PostPts text, -- Postseason points, example: ['0', '3']\n PostPIM text, -- Postseason penalty minutes, example: ['2', '0']\n PostPPG text, -- Postseason power play goals, example: ['0', '1']\n PostSHG text, -- Postseason Shorthanded goals, example: ['0', '1']\n PostSOG text, -- Postseason shots on goal, example: ['0', '11']\n CONSTRAINT fk_scoring_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoring_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoring_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsSC (\n `year` integer, -- example: [1912, 1913]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['QU1', 'VA1']\n G integer, -- Games, example: [3, 5]\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [2, 1]\n T integer, -- ties, example: [0, 1]\n PIM text, -- penalty minutes, example: ['24', '20']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamssc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamssc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Master (\n playerID text, -- example: ['aaltoan01', 'abbeybr01']\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n firstName text, -- example: ['Antti', 'Bruce']\n lastName text, -- example: ['Aalto', 'Abbey']\n nameNote text, -- example: ['also known as Bellehumeur', 'also listed as Bourdginon']\n nameGiven text, -- example: ['Antti', 'Bruce']\n nameNick text, -- Nickname, example: ['G', 'Preacher', 'Taffy']\n height text, -- example: ['73', '67']\n ihdbID text, -- Internet Hockey Database ID, example: ['5928', '11918']\n firstNHL text, -- First NHL season, example: ['1997', '1943']\n pos text, -- position, example: ['G', 'C', 'D']\n birthYear text, -- example: ['1975', '1951']\n birthDay text, -- example: ['4', '18']\n birthState text, -- example: ['ON', 'MB']\n deathYear text, -- example: ['1964', '2000']\n deathCountry text, -- example: ['USA', 'Canada']\n deathState text, -- example: ['MI', 'AB']\n deathCity text, -- example: ['Boston', 'Sault Ste. Marie', 'Farmington']\n CONSTRAINT fk_master_coachid FOREIGN KEY (coachID) REFERENCES Coaches (coachID)\n);\n\nCREATE TABLE CombinedShutouts (\n `year` integer, -- example: [1929, 1941]\n `date` integer, -- example: [14, 15]\n tmID text, -- team ID, example: ['TOR', 'MTL']\n oppID text, -- opposite team ID, example: ['NYA', 'BOS']\n IDgoalie1 text, -- ID of goalie 1, example: ['chabolo01', 'bibeapa01']\n IDgoalie2 text, -- ID of goalie 2, example: ['grantbe01', 'gardibe01']\n CONSTRAINT fk_combinedshutouts_idgoalie1 FOREIGN KEY (IDgoalie1) REFERENCES Master (playerID),\n CONSTRAINT fk_combinedshutouts_idgoalie2 FOREIGN KEY (IDgoalie2) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSC (\n playerID text, -- example: ['adamsbi01', 'adamsja01']\n `year` integer, -- example: [1920, 1921]\n tmID text, -- team ID, example: ['VML', 'CAT']\n pos text, -- position, example: ['G', 'R', 'C']\n GP integer, -- Games played, example: [4, 5]\n G integer, -- Goals, example: [0, 2]\n A integer, -- assists, example: [0, 1]\n Pts integer, -- points, example: [0, 3]\n CONSTRAINT fk_scoringsc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringsc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringsc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Teams (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n franchID text, -- Franchise ID, example: ['BKN', 'MTL']\n rank integer, -- example: [4, 5]\n playoff text, -- example: ['LCS', 'WCS']\n G integer, -- games, example: [12, 16]\n W integer, -- wins, example: [4, 2]\n L integer, -- loses, example: [8, 10]\n T integer, -- ties, example: [0, 1]\n OTL text, -- Overtime losses, example: ['3', '4']\n SoL text, -- Shootout loses, example: ['7', '5']\n GA integer, -- Goals against, example: [104, 83]\n name text, -- Full team name, example: ['Boston Bruins', 'Cobalt Silver Kings', 'Haileybury Hockey Club']\n BenchMinor text, -- Bench minors (minutes), example: ['12', '14']\n PPC text, -- Power play chances, example: ['220', '279']\n SHA text, -- Shorthanded goals against, example: ['4', '2']\n PKG text, -- Power play goals against, example: ['45', '43']\n SHF text, -- Shorthanded goals for, example: ['3', '8']\n PRIMARY KEY (`year`, tmID)\n);\n\nCREATE TABLE ScoringShootout (\n playerID text, -- example: ['adamske01', 'afanadm01']\n `year` integer, -- example: [2006, 2005]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['PHO', 'TBL']\n S integer, -- shots, example: [1, 2]\n G integer, -- goals, example: [0, 1]\n GDG integer, -- game deciding goals, example: [0, 1]\n CONSTRAINT fk_scoringshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_scoringshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_scoringshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsMisc (\n name text, -- example: ['1960 U.S. Olympic Hockey Team', \"1998 U.S. Olympic Women's Hockey Team\"]\n ID text, -- example: ['arboual01', 'delveal01']\n award text, -- example: ['Patrick']\n `year` integer, -- example: [2001, 1998]\n lgID text, -- league ID, example: ['NHL']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE GoaliesSC (\n playerID text, -- example: ['benedcl01', 'clancki01']\n `year` integer, -- example: [1914, 1919]\n tmID text, -- team ID, example: ['OT1', 'OTS']\n lgID text, -- league ID, example: ['NHA', 'NHL']\n GP integer, -- Games played, example: [3, 5]\n `Min` integer, -- Minutes, example: [180, 300]\n W integer, -- Wins, example: [0, 3]\n L integer, -- Loses, example: [3, 2]\n T integer, -- Ties, example: [0, 1]\n SHO integer, -- Shutouts, example: [0, 1]\n GA integer, -- Goals against, example: [26, 11]\n PRIMARY KEY (playerID, `year`),\n CONSTRAINT fk_goaliessc_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliessc_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliessc_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE abbrev (\n Type text, -- example: ['Conference', 'Division']\n Code text, -- example: ['CC', 'EC']\n Fullname text, -- example: ['Campbell Conference', 'Eastern Conference']\n PRIMARY KEY (Type, Code)\n);\n\nCREATE TABLE GoaliesShootout (\n playerID text, -- example: ['aebisda01', 'andercr01']\n `year` integer, -- example: [2005, 2006]\n stint integer, -- example: [1, 2]\n tmID text, -- team ID, example: ['COL', 'MTL']\n W integer, -- Wins, example: [2, 0]\n L integer, -- Loses, example: [1, 2]\n CONSTRAINT fk_goaliesshootout_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID),\n CONSTRAINT fk_goaliesshootout_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_goaliesshootout_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE HOF (\n `year` integer, -- example: [1969, 1960]\n hofID text, -- hall of fame id, example: ['abelsi01h', 'adamsch01h']\n name text, -- example: ['Sid Abel', 'Charles Adams']\n category text, -- example: ['Player', 'Builder']\n PRIMARY KEY (hofID)\n);\n\nCREATE TABLE TeamSplits (\n `year` integer, -- example: [1909, 1910]\n lgID text, -- league ID, example: ['NHA', 'PCHA']\n tmID text, -- team ID, example: ['COB', 'HAI']\n hW integer, -- home wins, example: [2, 3]\n hL integer, -- home loses, example: [4, 3]\n hT integer, -- home ties, example: [0, 1]\n rW integer, -- Road wins, example: [2, 1]\n rL integer, -- Road loses, example: [4, 5]\n rT integer, -- Road ties, example: [0, 1]\n rOTL text, -- road overtime loses, example: ['1', '5']\n SepL text, -- September loses, example: ['1']\n SepT text, -- September ties\n SepOL text, -- September overtime loses, example: ['0']\n OctW text, -- October wins, example: ['0', '1']\n OctL text, -- October loses, example: ['1', '0']\n OctT text, -- October ties, example: ['0', '1']\n OctOL text, -- October overtime loses, example: ['1', '0']\n NovT text, -- November ties, example: ['0', '1']\n DecW text, -- December wins, example: ['0', '1']\n DecL text, -- December loses, example: ['1', '0']\n DecOL text, -- December overtime loses, example: ['0', '2']\n JanOL text, -- January overtime loses, example: ['0', '1']\n FebL integer, -- February loses, example: [3, 5]\n FebOL text, -- February overtime loses, example: ['0', '1']\n MarL text, -- March loses, example: ['4', '0']\n MarT text, -- March ties, example: ['0', '1']\n MarOL text, -- March overtime loses, example: ['1', '0']\n AprW text, -- April wins, example: ['1', '0']\n AprT text, -- April ties, example: ['0', '1']\n AprOL text, -- April overtime loses, example: ['1', '0']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamsplits_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamsplits_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamVsTeam (\n `year` integer, -- example: [1909, 1910]\n tmID text, -- team ID, example: ['COB', 'HAI']\n oppID text, -- opponent ID, example: ['HAI', 'LES']\n W integer, -- wins, example: [1, 2]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n OTL text, -- overtime loses, example: ['0', '1']\n PRIMARY KEY (`year`, tmID, oppID),\n CONSTRAINT fk_teamvsteam_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamvsteam_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID),\n CONSTRAINT fk_teamvsteam_oppid FOREIGN KEY (oppID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsHalf (\n `year` integer, -- example: [1916, 1917]\n lgID text, -- league ID, example: ['NHA', 'NHL']\n tmID text, -- team ID, example: ['MOC', 'MOW']\n half integer, -- example: [1, 2]\n rank integer, -- example: [1, 3]\n G integer, -- Games, example: [10, 4]\n W integer, -- wins, example: [7, 3]\n L integer, -- loses, example: [3, 7]\n T integer, -- ties, example: [0]\n GF integer, -- goals for, example: [58, 31]\n PRIMARY KEY (`year`, tmID, half),\n CONSTRAINT fk_teamshalf_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamshalf_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE AwardsPlayers (\n playerID text, -- example: ['abelsi01', 'alfreda01']\n award text, -- example: ['First Team All-Star', 'Hart']\n `year` integer, -- example: [1948, 1949]\n pos text, -- position, example: ['G', 'C', 'LW']\n PRIMARY KEY (playerID, award, `year`),\n CONSTRAINT fk_awardsplayers_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE ScoringSup (\n playerID text, -- example: ['actonke01', 'adamsgr01']\n `year` integer, -- example: [1988, 1989]\n SHA text, -- Shorthanded assists, example: ['1', '2']\n CONSTRAINT fk_scoringsup_playerid FOREIGN KEY (playerID) REFERENCES Master (playerID)\n);\n\nCREATE TABLE SeriesPost (\n `year` integer, -- example: [1912, 1913]\n round text, -- example: ['SCF', 'F']\n tmIDWinner text, -- Team ID of winner, example: ['VA1', 'TBS']\n lgIDWinner text, -- League ID of winner, example: ['PCHA', 'NHA']\n tmIDLoser text, -- Team ID of loser, example: ['QU1', 'MOC']\n W integer, -- wins, example: [2, 1]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GoalsWinner integer, -- goals for winner, example: [16, 6]\n GoalsLoser integer, -- goals for loser, example: [12, 2]\n note text, -- example: ['EX', 'TG']\n CONSTRAINT fk_seriespost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_seriespost_tmidwinner FOREIGN KEY (tmIDWinner) REFERENCES Teams (tmID),\n CONSTRAINT fk_seriespost_tmidloser FOREIGN KEY (tmIDLoser) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE TeamsPost (\n `year` integer, -- example: [1913, 1914]\n tmID text, -- team ID, example: ['MOC', 'TBS']\n G integer, -- Games, example: [2, 5]\n W integer, -- wins, example: [1, 0]\n L integer, -- loses, example: [1, 0]\n T integer, -- ties, example: [0, 1]\n GF integer, -- goals for, example: [2, 6]\n GA integer, -- goals against, example: [6, 2]\n PIM text, -- penalty minutes, example: ['59', '68']\n BenchMinor text, -- Bench minors (minutes), example: ['0', '6']\n PKC text, -- Penalty kill chances, example: ['55', '45']\n PRIMARY KEY (`year`, tmID),\n CONSTRAINT fk_teamspost_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_teamspost_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\n\nCREATE TABLE Coaches (\n coachID text, -- example: ['abelsi01c', 'adamsja01c']\n `year` integer, -- example: [1952, 1953]\n tmID text, -- team ID, example: ['CHI', 'DET']\n lgID text, -- league ID, example: ['NHL', 'WHA']\n stint integer, -- example: [1, 2]\n notes text, -- example: ['interim', 'co-coach with Barry Smith']\n g integer, -- games, example: [70, 33]\n w integer, -- wins, example: [27, 12]\n l integer, -- loses, example: [28, 51]\n t integer, -- ties, example: [15, 7]\n postg text, -- post-season games, example: ['7', '4']\n postw text, -- post-season wins, example: ['3', '0']\n PRIMARY KEY (coachID, `year`, tmID, stint),\n CONSTRAINT fk_coaches_year FOREIGN KEY (`year`) REFERENCES Teams (`year`),\n CONSTRAINT fk_coaches_tmid FOREIGN KEY (tmID) REFERENCES Teams (tmID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoalies refers to pos = 'G'; season refers to year\n\nName the goalies and season they played when Boston Bruins won number 1 in rank.\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.