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 Indicators (\n CountryName text, -- Country code, example: ['Low income', 'South Asia', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'South Asia', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Low income', 'South Asia', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'South Asia', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to longname; the countries in South Asia refer to region = 'South Asia'; belongs to the low income group refers to incomegroup = 'Low income'\nWhat are the full names of the countries in South Asia that belongs to the low income group?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 LongName FROM Country WHERE IncomeGroup = 'Low income' AND Region = 'South Asia'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT LongName FROM Country WHERE IncomeGroup = 'Low income' AND Region = 'South Asia'", "index": 1100, "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 Indicators (\n CountryName text, -- Country code, example: ['Low income', 'South Asia', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Low income', 'South Asia', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Low income', 'South Asia', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Low income', 'South Asia', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to longname; the countries in South Asia refer to region = 'South Asia'; belongs to the low income group refers to incomegroup = 'Low income'\nWhat are the full names of the countries in South Asia that belongs to the low income group?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Mobile cellular subscriptions', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Brazil', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Mobile cellular subscriptions', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMobile Cellular Subscriptions refers to indicatorname = 'Mobile cellular subscriptions'; Brazil refers to CountryName = 'Brazil'\nWhat is the indicator code for Mobile Cellular Subscriptions of Brazil?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT IndicatorCode FROM Indicators WHERE CountryName = 'Brazil' AND IndicatorName = 'Mobile cellular subscriptions'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT DISTINCT IndicatorCode FROM Indicators WHERE CountryName = 'Brazil' AND IndicatorName = 'Mobile cellular subscriptions'", "index": 1101, "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 Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Mobile cellular subscriptions', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Brazil', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Mobile cellular subscriptions', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMobile Cellular Subscriptions refers to indicatorname = 'Mobile cellular subscriptions'; Brazil refers to CountryName = 'Brazil'\nWhat is the indicator code for Mobile Cellular Subscriptions of Brazil?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Rural population (% of total population)', 'Rural population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Rural population (% of total population)', 'Rural population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest percentage of rural population in the overall total population refers to max(value where indicatorname = 'Rural population (% of total population)')\nWhat is the name of the country with the highest percentage of rural population in the overall total population? Indicate the rural population percentage of total population.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 countryname, MAX(value) FROM indicators WHERE indicatorname = 'Rural population (% of total population)'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT countryname, MAX(value) FROM indicators WHERE indicatorname = 'Rural population (% of total population)'", "index": 1102, "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 CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Rural population (% of total population)', 'Rural population', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Rural population (% of total population)', 'Rural population', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest percentage of rural population in the overall total population refers to max(value where indicatorname = 'Rural population (% of total population)')\nWhat is the name of the country with the highest percentage of rural population in the overall total population? Indicate the rural population percentage of total population.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Census.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave a latest population census in 2011 refers to LatestPopulationCensus = '2011'; full name refers to LongName\nHow many countries have a latest population census in 2011? Indicate their full names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(LongName) FROM country WHERE LatestPopulationCensus = '2011' UNION ALL SELECT LongName FROM country WHERE LatestPopulationCensus = '2011'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT COUNT(LongName) FROM country WHERE LatestPopulationCensus = '2011' UNION ALL SELECT LongName FROM country WHERE LatestPopulationCensus = '2011'", "index": 1103, "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 CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n OtherWebLinks integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Census.', 'Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave a latest population census in 2011 refers to LatestPopulationCensus = '2011'; full name refers to LongName\nHow many countries have a latest population census in 2011? Indicate their full names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['Sub-Saharan Africa', 'South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Sub-Saharan Africa refers to Region = 'Sub-Saharan Africa'; the higest number of female out-of-school children of primary school age refers to max(value where IndicatorName = 'Out-of-school children of primary school age, female (number)')\nIn Sub-Saharan Africa, how many female out-of-school children of primary school age are there in the country with the higest number of female out-of-school children of primary school age? Indicate the year of when it was recorded.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT MAX(T1.value), T1.year FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Sub-Saharan Africa' AND T1.IndicatorName = 'Out-of-school children of primary school age, female (number)'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT MAX(T1.value), T1.year FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Sub-Saharan Africa' AND T1.IndicatorName = 'Out-of-school children of primary school age, female (number)'", "index": 1104, "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 CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Region text, -- example: ['Sub-Saharan Africa', 'South Asia', 'Europe & Central Asia']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Sub-Saharan Africa refers to Region = 'Sub-Saharan Africa'; the higest number of female out-of-school children of primary school age refers to max(value where IndicatorName = 'Out-of-school children of primary school age, female (number)')\nIn Sub-Saharan Africa, how many female out-of-school children of primary school age are there in the country with the higest number of female out-of-school children of primary school age? Indicate the year of when it was recorded.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Indicators (\n CountryName text, -- Country code, example: ['Afghanistan', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Number of infant deaths', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Number of infant deaths', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\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 infant deaths refers to IndicatorName = 'Number of infant deaths'; in year 1965 refers to Year = '1965'; full name is Islamic State of Afghanistan refers to LongName = 'Islamic State of Afghanistan'\nWhat is the series code for number of infant deaths in year 1965 for the country whose full name is Islamic State of Afghanistan?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T3.Seriescode FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN CountryNotes AS T3 ON T2.CountryCode = T3.Countrycode WHERE T2.IndicatorName = 'Number of infant deaths' AND T1.LongName = 'Islamic State of Afghanistan' AND T2.Year = 1965", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT DISTINCT T3.Seriescode FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN CountryNotes AS T3 ON T2.CountryCode = T3.Countrycode WHERE T2.IndicatorName = 'Number of infant deaths' AND T1.LongName = 'Islamic State of Afghanistan' AND T2.Year = 1965", "index": 1105, "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 Indicators (\n CountryName text, -- Country code, example: ['Afghanistan', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Number of infant deaths', 'Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Number of infant deaths', 'Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\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 infant deaths refers to IndicatorName = 'Number of infant deaths'; in year 1965 refers to Year = '1965'; full name is Islamic State of Afghanistan refers to LongName = 'Islamic State of Afghanistan'\nWhat is the series code for number of infant deaths in year 1965 for the country whose full name is Islamic State of Afghanistan?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Region text, -- example: ['Middle East & North Africa', 'South Asia', 'Europe & Central Asia']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuses the 1968 System of National Accounts methodology refers to SystemOfNationalAccounts = '1968 System of National Accounts methodology'; in the Middle East & North Africa refers to Region = 'Middle East & North Africa'; the highest CO2 emissions from solid fuel consumption in kiloton refers to max(value where IndicatorName = 'CO2 emissions from solid fuel consumption (kt)')\nAmong the countries who uses the 1968 System of National Accounts methodology, how many are in the Middle East & North Africa? Name the country with the highest CO2 emissions from solid fuel consumption in kiloton.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T1.CountryCode) FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T2.SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' AND T1.IndicatorName = 'CO2 emissions FROM solid fuel consumption (kt)' UNION SELECT * FROM ( SELECT T1.CountryName FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T2.SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' AND T1.IndicatorName = 'CO2 emissions FROM solid fuel consumption (kt)' GROUP BY T1.CountryName ORDER BY SUM(T1.value) DESC LIMIT 1 )", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.CountryCode) FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T2.SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' AND T1.IndicatorName = 'CO2 emissions FROM solid fuel consumption (kt)' UNION SELECT * FROM ( SELECT T1.CountryName FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T2.SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' AND T1.IndicatorName = 'CO2 emissions FROM solid fuel consumption (kt)' GROUP BY T1.CountryName ORDER BY SUM(T1.value) DESC LIMIT 1 )", "index": 1106, "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 Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Region text, -- example: ['Middle East & North Africa', 'South Asia', 'Europe & Central Asia']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuses the 1968 System of National Accounts methodology refers to SystemOfNationalAccounts = '1968 System of National Accounts methodology'; in the Middle East & North Africa refers to Region = 'Middle East & North Africa'; the highest CO2 emissions from solid fuel consumption in kiloton refers to max(value where IndicatorName = 'CO2 emissions from solid fuel consumption (kt)')\nAmong the countries who uses the 1968 System of National Accounts methodology, how many are in the Middle East & North Africa? Name the country with the highest CO2 emissions from solid fuel consumption in kiloton.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Periodicity text, -- example: ['Annual']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Republic of Albania', 'Islamic State of Afghanistan']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Republic of Albania refers to LongName = 'Republic of Albania'; in the year 1960 refers to Year = '1960'\nWhat are the indicator codes for the Republic of Albania in the year 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.IndicatorCode FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Year = 1960 AND T2.LongName = 'Republic of Albania'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT DISTINCT T1.IndicatorCode FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Year = 1960 AND T2.LongName = 'Republic of Albania'", "index": 1107, "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 Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Periodicity text, -- example: ['Annual']\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedIndicators integer,\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n LongName text, -- example: ['Republic of Albania', 'Islamic State of Afghanistan']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Republic of Albania refers to LongName = 'Republic of Albania'; in the year 1960 refers to Year = '1960'\nWhat are the indicator codes for the Republic of Albania in the year 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Angola', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Angola', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Angola refers to ShortName = 'Angola'; when refers to PppSurveyYear\nWhat's the lastest household survey in Angola and when did it take place?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 LatestHouseholdSurvey, PppSurveyYear FROM Country WHERE ShortName = 'Angola'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT LatestHouseholdSurvey, PppSurveyYear FROM Country WHERE ShortName = 'Angola'", "index": 1108, "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 SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Angola', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Angola', 'Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin Angola refers to ShortName = 'Angola'; when refers to PppSurveyYear\nWhat's the lastest household survey in Angola and when did it take place?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['1A', 'AG', 'AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['1A', 'AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindicator Adolescent fertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'\n\n\nIn which years does the country whose Alpha2Code is 1A have a result of the indicator Adolescent fertility rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Year FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT T2.Year FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'", "index": 1109, "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 CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['1A', 'AG', 'AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['1A', 'AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindicator Adolescent fertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'\n\n\nIn which years does the country whose Alpha2Code is 1A have a result of the indicator Adolescent fertility rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ARM', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ARM', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ARM', 'ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ARM', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlong name refers to CountryName; got 3000000 on the indicator Arms exports refers to value where IndicatorName = 'Arms exports (SIPRI trend indicator values)' = 3000000; in 1960 refers to Year = 1960\nWhat's the long name of the country that got 3000000 on the indicator Arms exports in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Arms exports (SIPRI trend indicator values)' AND T2.Year = 1960 AND T2.Value = 3000000", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT T1.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Arms exports (SIPRI trend indicator values)' AND T2.Year = 1960 AND T2.Value = 3000000", "index": 1110, "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 Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ARM', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ARM', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ARM', 'ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ARM', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlong name refers to CountryName; got 3000000 on the indicator Arms exports refers to value where IndicatorName = 'Arms exports (SIPRI trend indicator values)' = 3000000; in 1960 refers to Year = 1960\nWhat's the long name of the country that got 3000000 on the indicator Arms exports in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Aruba', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Aruba', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Environment: Energy production & use', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnote refers to Description; for Aruba refers to ShortName = 'Aruba'\nPlease list the notes for Aruba on the indicators under the topic of Environment: Energy production & use.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T1.ShortName = 'Aruba' AND T3.Topic = 'Environment: Energy production & use'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T1.ShortName = 'Aruba' AND T3.Topic = 'Environment: Energy production & use'", "index": 1111, "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 Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n TableName text, -- example: ['Aruba', 'Afghanistan', 'Albania']\n LongName text, -- example: ['Aruba', 'Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['US', 'AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['US', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Aruba', 'Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Environment: Energy production & use', 'Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnote refers to Description; for Aruba refers to ShortName = 'Aruba'\nPlease list the notes for Aruba on the indicators under the topic of Environment: Energy production & use.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.FRST.K2']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindicator BX.KLT.DINV.CD.WD refers to Seriescode = 'BX.KLT.DINV.CD.WD'\nWhich countries have notes on the indicator BX.KLT.DINV.CD.WD?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.ShortName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T3.Seriescode = 'BX.KLT.DINV.CD.WD'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT T1.ShortName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T3.Seriescode = 'BX.KLT.DINV.CD.WD'", "index": 1112, "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 SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.LND.FRST.K2']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['BX.KLT.DINV.CD.WD', 'AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n RelatedIndicators integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['BX.KLT.DINV.CD.WD', 'EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n TableName text, -- example: ['Afghanistan', 'Albania']\n LongName text, -- example: ['Islamic State of Afghanistan', 'Republic of Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AF', 'AL']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n NationalAccountsReferenceYear text, -- example: ['1996', '2013/14']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n AlternativeConversionFactor text, -- example: ['1991\\x9696', '1971\\x9684']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ExternalDebtReportingStatus text, -- example: ['Actual', 'Preliminary']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n LatestWaterWithdrawalData integer, -- example: [2000, 2006]\n PRIMARY KEY (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindicator BX.KLT.DINV.CD.WD refers to Seriescode = 'BX.KLT.DINV.CD.WD'\nWhich countries have notes on the indicator BX.KLT.DINV.CD.WD?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindicator Stocks traded, turnover ratio of domestic shares refers to IndicatorName = 'Stocks traded, turnover ratio of domestic shares (%)'\nHow many countries have notes on the indicator Stocks traded, turnover ratio of domestic shares?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.Countrycode) FROM CountryNotes AS T1 INNER JOIN Series AS T2 ON T1.Seriescode = T2.SeriesCode WHERE T2.IndicatorName = 'Stocks traded, turnover ratio of domestic shares (%)'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT COUNT(T1.Countrycode) FROM CountryNotes AS T1 INNER JOIN Series AS T2 ON T1.Seriescode = T2.SeriesCode WHERE T2.IndicatorName = 'Stocks traded, turnover ratio of domestic shares (%)'", "index": 1113, "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 Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n UnitOfMeasure text, -- example: ['`', '%']\n BasePeriod text, -- example: ['2005', 'varies by country']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n CurrencyUnit text, -- example: ['Afghan afghani', 'Albanian lek']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Wb2Code text, -- world bank to code, example: ['AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n SnaPriceValuation text, -- example: ['Value added at basic prices (VAB)', 'Value added at producer prices (VAP)']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n BalanceOfPaymentsManualInUse text, -- example: ['IMF Balance of Payments Manual, 6th edit']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n LatestPopulationCensus text, -- example: ['1979', '2011']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindicator Stocks traded, turnover ratio of domestic shares refers to IndicatorName = 'Stocks traded, turnover ratio of domestic shares (%)'\nHow many countries have notes on the indicator Stocks traded, turnover ratio of domestic shares?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Arab World', 'World', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1960 refers to Year = 1960; for the Arab World refers to CountryName = 'Arab World'\nWhat's the value of the indicator whose long definition is \"Adolescent fertility rate is the number of births per 1,000 women ages 15-19.\" for the Arab World in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.Value FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName INNER JOIN Country AS T3 ON T1.CountryCode = T3.CountryCode WHERE T2.LongDefinition = 'Adolescent fertility rate is the number of births per 1,000 women ages 15-19.' AND T3.ShortName = 'Arab World' AND T1.Year = 1960", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT T1.Value FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName INNER JOIN Country AS T3 ON T1.CountryCode = T3.CountryCode WHERE T2.LongDefinition = 'Adolescent fertility rate is the number of births per 1,000 women ages 15-19.' AND T3.ShortName = 'Arab World' AND T1.Year = 1960", "index": 1114, "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 Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n Description text, -- example: ['Sources: Estimated based on UN Energy St', 'Sources: UN Energy Statistics (2014)']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n ShortDefinition text, -- example: ['Total external debt is debt owed to nonr', 'Debt service is the sum of principle rep']\n LongDefinition text, -- example: ['Foreign direct investment are the net in', 'Foreign direct investment refers to dire']\n Periodicity text, -- example: ['Annual']\n OtherNotes integer,\n AggregationMethod text, -- example: ['Weighted average', 'Sum']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n NotesFromOriginalSource text, -- example: ['Estimates are presented with uncertainty', 'In some cases, the sum of public and pri']\n GeneralComments text, -- example: ['Note: Data are based on the sixth editio', 'Note: Data starting from 2005 are based ']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n RelatedSourceLinks text, -- example: ['World Bank, PovcalNet: an online poverty']\n OtherWebLinks integer,\n LicenseType text, -- example: ['Open', 'Restricted']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Arab World', 'World', 'Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['AG', 'AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n Region text, -- example: ['South Asia', 'Europe & Central Asia']\n IncomeGroup text, -- example: ['Low income', 'Upper middle income']\n Wb2Code text, -- world bank to code, example: ['AG', 'AF', 'AL']\n NationalAccountsBaseYear text, -- example: ['2002/03', 'Original chained constant price data are']\n LendingCategory text, -- example: ['IDA', 'IBRD']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n ImfDataDisseminationStandard text, -- International Monetory Fund Data Dissemination Standard, example: ['General Data Dissemination System (GDDS)', 'Special Data Dissemination Standard (SDD']\n SourceOfMostRecentIncomeAndExpenditureData text, -- example: ['Integrated household survey (IHS), 2008', 'Living Standards Measurement Study Surve']\n VitalRegistrationComplete text, -- example: ['Yes', 'Yes. Vital registration for Guernsey and']\n LatestAgriculturalCensus text, -- example: ['2013/14', '2012']\n LatestIndustrialData integer, -- example: [2011, 2010]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n Description text, -- example: ['Interpolated using data for 1957 and 196']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 1960 refers to Year = 1960; for the Arab World refers to CountryName = 'Arab World'\nWhat's the value of the indicator whose long definition is \"Adolescent fertility rate is the number of births per 1,000 women ages 15-19.\" for the Arab World in 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n Alpha2Code text, -- Alpha to Code, example: ['1A', 'AG', 'AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe percentage of increase from 1960 to 1961 = divide(subtract(sum(value where Year = 1961), sum(Value where Year = 1960)), sum(Value where Year = 1960)) *100%; indicator on Adolescent fertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)%'\n\n\nWhat is the percentage of increase of the indicator on Adolescent fertility rate from 1960 to 1961 in the country whose Alpha2Code is 1A?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT (( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1961 ) - ( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1960 )) * 1.0 / ( SELECT SUM(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1960 )", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT (( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1961 ) - ( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1960 )) * 1.0 / ( SELECT SUM(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1960 )", "index": 1115, "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 Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n Alpha2Code text, -- Alpha to Code, example: ['1A', 'AG', 'AF', 'AL']\n SpecialNotes text, -- example: ['Fiscal year end: March 20; reporting per', 'April 2013 database update: Based on IMF']\n SystemOfTrade text, -- example: ['General trade system', 'Special trade system']\n LatestIndustrialData integer, -- example: [2011, 2010]\n LatestTradeData integer, -- example: [2013, 2006]\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n UnitOfMeasure text, -- example: ['`', '%']\n Periodicity text, -- example: ['Annual']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n Source text, -- example: ['International Monetary Fund, Balance of ', 'International Monetary Fund, Internation']\n DevelopmentRelevance text, -- example: ['Private financial flows - equity and deb', 'The balance of payments records an econo']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n Description text, -- example: ['Not specified', 'Source: United Nations Conference on Tra']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe percentage of increase from 1960 to 1961 = divide(subtract(sum(value where Year = 1961), sum(Value where Year = 1960)), sum(Value where Year = 1960)) *100%; indicator on Adolescent fertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)%'\n\n\nWhat is the percentage of increase of the indicator on Adolescent fertility rate from 1960 to 1961 in the country whose Alpha2Code is 1A?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['1A', 'AG', 'AF', 'AL']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage value = AVG(Value) where IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'\nWhat is the average value of Adolescent fertility rate in the country whose Alpha2Code is 1A?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(T2.Value) AS REAL) * 100 / COUNT(T2.Year) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'", "style": "rule" }
{ "db_id": "world_development_indicators.sqlite", "gt_sql": "SELECT CAST(SUM(T2.Value) AS REAL) * 100 / COUNT(T2.Year) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'", "index": 1116, "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 Footnotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['AG.LND.FRST.K2', 'BX.KLT.DINV.CD.WD']\n `Year` text, -- example: ['YR1990', 'YR2000']\n PRIMARY KEY (Countrycode, Seriescode, `Year`),\n CONSTRAINT fk_footnotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_footnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE SeriesNotes (\n Seriescode text, -- example: ['DT.DOD.PVLX.CD', 'IC.CUS.DURS.EX']\n `Year` text, -- example: ['YR2014', 'YR2002']\n PRIMARY KEY (Seriescode, `Year`),\n CONSTRAINT fk_seriesnotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Country (\n CountryCode text, -- example: ['PER', 'ABW', 'ADO']\n ShortName text, -- example: ['Afghanistan', 'Albania']\n Alpha2Code text, -- Alpha to Code, example: ['1A', 'AG', 'AF', 'AL']\n OtherGroups text, -- example: ['HIPC', 'Euro area']\n SystemOfNationalAccounts text, -- example: ['Country uses the 1993 System of National', 'Country uses the 1968 System of National']\n PppSurveyYear text, -- purchasing power parity survey year, example: ['Rolling', '2011']\n GovernmentAccountingConcept text, -- example: ['Consolidated central government', 'Budgetary central government']\n LatestHouseholdSurvey text, -- example: ['Multiple Indicator Cluster Survey (MICS)', 'Demographic and Health Survey (DHS), 200']\n PRIMARY KEY (CountryCode)\n);\n\nCREATE TABLE CountryNotes (\n Countrycode text, -- example: ['PER', 'ABW', 'ADO']\n Seriescode text, -- example: ['EG.EGY.PRIM.PP.KD', 'EG.ELC.RNEW.ZS']\n PRIMARY KEY (Countrycode, Seriescode),\n CONSTRAINT fk_countrynotes_countrycode FOREIGN KEY (Countrycode) REFERENCES Country (CountryCode),\n CONSTRAINT fk_countrynotes_seriescode FOREIGN KEY (Seriescode) REFERENCES Series (SeriesCode)\n);\n\nCREATE TABLE Series (\n SeriesCode text, -- example: ['AG.AGR.TRAC.NO', 'AG.CON.FERT.PT.ZS']\n Topic text, -- example: ['Economic Policy & Debt: Balance of payme']\n IndicatorName text, -- example: ['Foreign direct investment, net (BoP, cur', 'Foreign direct investment, net inflows (']\n LimitationsAndExceptions text, -- example: ['FDI data do not give a complete picture ', 'Portfolio investors typically have less ']\n StatisticalConceptAndMethodology text, -- example: ['Data on equity flows are based on balanc']\n PRIMARY KEY (SeriesCode)\n);\n\nCREATE TABLE Indicators (\n CountryName text, -- Country code, example: ['Arab World', 'Caribbean small states']\n CountryCode text, -- Series code, example: ['PER', 'ABW', 'ADO']\n IndicatorName text, -- example: ['Adolescent fertility rate (births per 1,', 'Age dependency ratio (% of working-age p']\n IndicatorCode text, -- example: ['AG.LND.AGRI.K2', 'AG.LND.AGRI.ZS']\n `Year` integer, -- example: [1961, 1962]\n `Value` integer, -- example: [133, 87]\n PRIMARY KEY (CountryCode, IndicatorCode, `Year`),\n CONSTRAINT fk_indicators_countrycode FOREIGN KEY (CountryCode) REFERENCES Country (CountryCode)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage value = AVG(Value) where IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'\nWhat is the average value of Adolescent fertility rate in the country whose Alpha2Code is 1A?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the genres of the movies which actor id 851 is the star.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.genre FROM movies2actors AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T1.actorid = T3.actorid WHERE T3.actorid = 851", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.genre FROM movies2actors AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T1.actorid = T3.actorid WHERE T3.actorid = 851", "index": 1117, "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 actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the genres of the movies which actor id 851 is the star.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['USA', 'other']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\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 movies from the USA which user rating is less than 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 COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' AND T1.rating < 3", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' AND T1.rating < 3", "index": 1118, "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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['USA', 'other']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\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 movies from the USA which user rating is less than 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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Drama', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance a one country\nAmong the movies from France, how many of them are drama?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'France' AND T1.genre = 'drama'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'France' AND T1.genre = 'drama'", "index": 1119, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Drama', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance a one country\nAmong the movies from France, how many of them are drama?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies (\n movieid integer, -- example: [1672052, 1672111]\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\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 average occupation of users whose ratings are not more than 2 ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T2.occupation) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating < 2", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT AVG(T2.occupation) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating < 2", "index": 1120, "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 movies (\n movieid integer, -- example: [1672052, 1672111]\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\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 average occupation of users whose ratings are not more than 2 ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['USA', 'other']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA is a country\nList the top 10 USA movies, by descending order, from the highest to the lowest, the user rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' GROUP BY T1.movieid ORDER BY AVG(T1.rating) DESC LIMIT 10", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' GROUP BY T1.movieid ORDER BY AVG(T1.rating) DESC LIMIT 10", "index": 1121, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['USA', 'other']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA is a country\nList the top 10 USA movies, by descending order, from the highest to the lowest, the user rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country; year = 4 represents the newest date.\nWhat is the average rating of the newest movies from France?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(T1.rating) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'france' AND T2.year = 4", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT AVG(T1.rating) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'france' AND T2.year = 4", "index": 1122, "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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country; year = 4 represents the newest date.\nWhat is the average rating of the newest movies from France?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning\nWhat is the ID of audiences that gave the most rating 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 userid FROM u2base WHERE rating = 5 GROUP BY userid ORDER BY COUNT(movieid) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT userid FROM u2base WHERE rating = 5 GROUP BY userid ORDER BY COUNT(movieid) DESC LIMIT 1", "index": 1123, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning\nWhat is the ID of audiences that gave the most rating 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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the ID of actors that had worked together with director 22397? What was the genre of that movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.actorid, T4.genre FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid INNER JOIN movies2directors AS T4 ON T1.movieid = T4.movieid WHERE T4.directorid = 22397", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.actorid, T4.genre FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid INNER JOIN movies2directors AS T4 ON T1.movieid = T4.movieid WHERE T4.directorid = 22397", "index": 1124, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat are the ID of actors that had worked together with director 22397? What was the genre of that movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the ID of movies with running time of 3 and average revenue of 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.movieid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN directors AS T3 ON T2.directorid = T3.directorid WHERE T1.runningtime = 3 AND T3.avg_revenue = 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.movieid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN directors AS T3 ON T2.directorid = T3.directorid WHERE T1.runningtime = 3 AND T3.avg_revenue = 1", "index": 1125, "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 directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList down the ID of movies with running time of 3 and average revenue of 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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning\nWhat is the favourite movie genre for audiences of age 18?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.genre FROM movies2directors AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN users AS T3 ON T2.userid = T3.userid WHERE T3.age = 18 GROUP BY T1.genre ORDER BY COUNT(T1.movieid) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.genre FROM movies2directors AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN users AS T3 ON T2.userid = T3.userid WHERE T3.age = 18 GROUP BY T1.genre ORDER BY COUNT(T1.movieid) DESC LIMIT 1", "index": 1126, "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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning\nWhat is the favourite movie genre for audiences of age 18?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning\nMovies with rating 3 are viewed by audiences in which distinct age group?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.age FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating = 3", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT DISTINCT T2.age FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating = 3", "index": 1127, "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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning\nMovies with rating 3 are viewed by audiences in which distinct age group?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list down ID of movies acted by top 5 actors based on actor rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.movieid FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid GROUP BY T2.actorid ORDER BY AVG(T1.a_quality) DESC LIMIT 5", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.movieid FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid GROUP BY T2.actorid ORDER BY AVG(T1.a_quality) DESC LIMIT 5", "index": 1128, "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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list down ID of movies acted by top 5 actors based on actor rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Horror', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n u_gender text, -- user gender, example: ['M', 'F']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning; Difference of female and male audiences = count(female users) - count(male users); Female users refers to u_gender = 'F'; Male users refers to u_gender = 'M'\nWhat is the difference of female and male audiences in number who viewed horror movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(T2.u_gender = 'F', 1, 0)) - SUM(IIF(T2.u_gender = 'M', 1, 0)) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid INNER JOIN movies2directors AS T3 ON T3.movieid = T1.movieid WHERE T3.genre = 'horror'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT SUM(IIF(T2.u_gender = 'F', 1, 0)) - SUM(IIF(T2.u_gender = 'M', 1, 0)) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid INNER JOIN movies2directors AS T3 ON T3.movieid = T1.movieid WHERE T3.genre = 'horror'", "index": 1129, "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 actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Horror', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n u_gender text, -- user gender, example: ['M', 'F']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe audience and users are the same meaning; Difference of female and male audiences = count(female users) - count(male users); Female users refers to u_gender = 'F'; Male users refers to u_gender = 'M'\nWhat is the difference of female and male audiences in number who viewed horror movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYear contains relative value, higher year value refers to newer date; Year = 4 refers to newest date, Year = 1 refer to oldest date; In English means isEnglish = T\nPlease list the genre of the movies that are the newest and is in English.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 4 AND T1.isEnglish = 'T'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 4 AND T1.isEnglish = 'T'", "index": 1130, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYear contains relative value, higher year value refers to newer date; Year = 4 refers to newest date, Year = 1 refer to oldest date; In English means isEnglish = T\nPlease list the genre of the movies that are the newest and is in English.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['USA', 'other']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA is a country; not in English can be represented by isEnglish = 'F'\nAmong the action movies from the USA, how many of them are not in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' AND T1.isEnglish = 'F' AND T2.genre = 'Action'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' AND T1.isEnglish = 'F' AND T2.genre = 'Action'", "index": 1131, "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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['USA', 'other']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA is a country; not in English can be represented by isEnglish = 'F'\nAmong the action movies from the USA, how many of them are not in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYear contains relative value, higer year value refers to newer date; Year = 4 refers to newest date, Year = 1 refer to oldest date; Lowest rating = 1;isEnglish = 'T' means English movie\nFor the movies in English that are the oldest, how many of them have the lowest rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T1.movieid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 1 AND T2.rating = 1 AND T1.isEnglish = 'T'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.movieid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 1 AND T2.rating = 1 AND T1.isEnglish = 'T'", "index": 1132, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYear contains relative value, higer year value refers to newer date; Year = 4 refers to newest date, Year = 1 refer to oldest date; Lowest rating = 1;isEnglish = 'T' means English movie\nFor the movies in English that are the oldest, how many of them have the lowest rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country; Female users mean that u_gender = 'F'\nHow many different female users have rated movies from France?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.userid) FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.u_gender = 'F' AND T3.country = 'France'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.userid) FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.u_gender = 'F' AND T3.country = 'France'", "index": 1133, "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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country; Female users mean that u_gender = 'F'\nHow many different female users have rated movies from France?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirect well means the quality of directing is good, which means d_quality = 4.\nFor different directors who direct well, how many of them have directed an action film?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.directorid) FROM movies2directors AS T2 INNER JOIN directors AS T3 ON T2.directorid = T3.directorid WHERE T2.genre = 'Action' AND T3.d_quality = 4", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.directorid) FROM movies2directors AS T2 INNER JOIN directors AS T3 ON T2.directorid = T3.directorid WHERE T2.genre = 'Action' AND T3.d_quality = 4", "index": 1134, "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 movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndirect well means the quality of directing is good, which means d_quality = 4.\nFor different directors who direct well, how many of them have directed an action film?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na_quality = 5 refers to act the best, a_quality = 0 refers to act the worst\nPlease list the country of the movie that stars an actress who acts the worse.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.country FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.a_gender = 'F' AND T1.a_quality = 0", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T3.country FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.a_gender = 'F' AND T1.a_quality = 0", "index": 1135, "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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na_quality = 5 refers to act the best, a_quality = 0 refers to act the worst\nPlease list the country of the movie that stars an actress who acts the worse.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['USA', 'other']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA is a country\nWhat is the highest average rating for action movies made in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(T2.rating) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN movies2directors AS T3 ON T1.movieid = T3.movieid WHERE T1.country = 'USA' AND T3.genre = 'Action' GROUP BY T1.movieid ORDER BY AVG(T2.rating) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT AVG(T2.rating) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN movies2directors AS T3 ON T1.movieid = T3.movieid WHERE T1.country = 'USA' AND T3.genre = 'Action' GROUP BY T1.movieid ORDER BY AVG(T2.rating) DESC LIMIT 1", "index": 1136, "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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['USA', 'other']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUSA is a country\nWhat is the highest average rating for action movies made in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies (\n movieid integer, -- example: [1672052, 1672111]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Adventure', 'Action']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich adventure movie has the highest average rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.movieid FROM movies2directors AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.genre = 'Adventure' GROUP BY T1.movieid ORDER BY AVG(T2.rating) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.movieid FROM movies2directors AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.genre = 'Adventure' GROUP BY T1.movieid ORDER BY AVG(T2.rating) DESC LIMIT 1", "index": 1137, "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 movies (\n movieid integer, -- example: [1672052, 1672111]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Adventure', 'Action']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich adventure movie has the highest average rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFemale users mean that u_gender = 'F'\nHow many of the users who rate the movie with the id '2462959' are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.userid) FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T2.userid = 2462959 AND T1.u_gender = 'F'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T1.userid) FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T2.userid = 2462959 AND T1.u_gender = 'F'", "index": 1138, "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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFemale users mean that u_gender = 'F'\nHow many of the users who rate the movie with the id '2462959' are female?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the ids and ratings of each actors played in the movie with the id 1722327?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.actorid, T1.a_quality FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid WHERE T2.movieid = 1722327", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.actorid, T1.a_quality FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid WHERE T2.movieid = 1722327", "index": 1139, "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 movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the ids and ratings of each actors played in the movie with the id 1722327?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nd_quality = 5 refers to direct the best\nWhich directors with the best quality directed the most films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 5 GROUP BY T1.directorid ORDER BY COUNT(T2.movieid) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 5 GROUP BY T1.directorid ORDER BY COUNT(T2.movieid) DESC LIMIT 1", "index": 1140, "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 actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nd_quality = 5 refers to direct the best\nWhich directors with the best quality directed the most films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Horror', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list all horror films that have a rating of 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.movieid FROM u2base AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 1 AND T2.genre = 'Horror'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.movieid FROM u2base AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 1 AND T2.genre = 'Horror'", "index": 1141, "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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Horror', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease list all horror films that have a rating of 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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nisEnglish = 'F' means non-English\nWhich genre contains the greatest number of non-English films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.isEnglish = 'F' GROUP BY T2.genre ORDER BY COUNT(T1.movieid) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.isEnglish = 'F' GROUP BY T2.genre ORDER BY COUNT(T1.movieid) DESC LIMIT 1", "index": 1142, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nisEnglish = 'F' means non-English\nWhich genre contains the greatest number of non-English films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the cast and the director of the movie with the id 1949144.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.actorid, T2.directorid FROM movies2actors AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.movieid = 1949144", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.actorid, T2.directorid FROM movies2actors AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.movieid = 1949144", "index": 1143, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the cast and the director of the movie with the id 1949144.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['UK', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUK is a country\nAmong the actors who acted in UK movies, what percentage of actors received a rating of at least 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 CAST(SUM(IIF(T3.a_quality >= 3, 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T1.country = 'UK'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T3.a_quality >= 3, 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T1.country = 'UK'", "index": 1144, "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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['UK', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUK is a country\nAmong the actors who acted in UK movies, what percentage of actors received a rating of at least 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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'box office success paradox' means average revenue exceeds their quality; The proportion can be computed by [(avg_revenue > d_quality) / ()] * 100%\nWhat is the proportion of action movies directors who are called 'box office success paradox'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(IIF(T2.avg_revenue > T2.d_quality, 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN directors AS T2 ON T1.directorid = T2.directorid WHERE T1.genre = 'Action'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T2.avg_revenue > T2.d_quality, 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN directors AS T2 ON T1.directorid = T2.directorid WHERE T1.genre = 'Action'", "index": 1145, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'box office success paradox' means average revenue exceeds their quality; The proportion can be computed by [(avg_revenue > d_quality) / ()] * 100%\nWhat is the proportion of action movies directors who are called 'box office success paradox'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country\nWhich actor has acted in at least 2 French films? Please list their IDs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.actorid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'France' GROUP BY T2.actorid HAVING COUNT(T1.movieid) > 2", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.actorid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'France' GROUP BY T2.actorid HAVING COUNT(T1.movieid) > 2", "index": 1146, "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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country\nWhich actor has acted in at least 2 French films? Please list their IDs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUS and UK are 2 countries\nHow many actors have acted in both US or UK films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.actorid) FROM movies2actors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' OR T2.country = 'UK'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T1.actorid) FROM movies2actors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' OR T2.country = 'UK'", "index": 1147, "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 movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUS and UK are 2 countries\nHow many actors have acted in both US or UK films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Drama', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\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 latest released dramas and action movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.year = 4 AND T1.genre IN ('Action', 'drama')", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.year = 4 AND T1.genre IN ('Action', 'drama')", "index": 1148, "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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Drama', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\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 latest released dramas and action movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Horror', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHigher value of running time means running time is longer\nWhat horror movies have a running time of at least 2? Please list movie IDs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.movieid FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.runningtime >= 2 AND T1.genre = 'Horror'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T1.movieid FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.runningtime >= 2 AND T1.genre = 'Horror'", "index": 1149, "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 actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Horror', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHigher value of running time means running time is longer\nWhat horror movies have a running time of at least 2? Please list movie IDs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat's different average revenue status for director who directed the movie that got the most 1 ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.avg_revenue FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 5", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT DISTINCT T1.avg_revenue FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 5", "index": 1150, "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 actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat's different average revenue status for director who directed the movie that got the most 1 ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country\nHow many French movies got the highest ranking?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(movieid) FROM movies WHERE country = 'France' AND movieid IN ( SELECT movieid FROM u2base WHERE rating = ( SELECT MAX(rating) FROM u2base ) )", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(movieid) FROM movies WHERE country = 'France' AND movieid IN ( SELECT movieid FROM u2base WHERE rating = ( SELECT MAX(rating) FROM u2base ) )", "index": 1151, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country\nHow many French movies got the highest ranking?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the movie that has been rated most by 25 years old users.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.movieid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T1.age = 25 GROUP BY T2.movieid ORDER BY COUNT(T1.userid) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.movieid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T1.age = 25 GROUP BY T2.movieid ORDER BY COUNT(T1.userid) DESC LIMIT 1", "index": 1152, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList the movie that has been rated most by 25 years old users.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFilms and movies share the same meaning; oldest film refers to the movie with year = 1\nPlease give the ids of the oldest films that got the most ratings.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 5 AND T2.year = 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT DISTINCT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 5 AND T2.year = 1", "index": 1153, "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 movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFilms and movies share the same meaning; oldest film refers to the movie with year = 1\nPlease give the ids of the oldest films that got the most ratings.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country\nWhich different movies from France got the least ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'France' AND T1.rating = 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT DISTINCT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'France' AND T1.rating = 1", "index": 1154, "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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['France', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrance is a country\nWhich different movies from France got the least ratings?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['USA', 'other']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrench and USA are two countries; Female actors mean that a_gender = 'F'\nHow many female actors have been played a role in any of French or USA movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.actorid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country IN ('France', 'USA')", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T2.actorid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country IN ('France', 'USA')", "index": 1155, "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 directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n country text, -- example: ['USA', 'other']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrench and USA are two countries; Female actors mean that a_gender = 'F'\nHow many female actors have been played a role in any of French or USA movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest rating of a movie is 5\nHow many different actors have played a role in the highest rating movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.actorid) FROM u2base AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 5", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.actorid) FROM u2base AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 5", "index": 1156, "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 movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest rating of a movie is 5\nHow many different actors have played a role in the highest rating movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUK is a country; Male actors mean that a_gender = 'M'; Female actors mean that a_gender = 'F'; ratio; ratio of gender in actors = count(a_gender = 'M') / a_gender = 'F'\nWhat's the ratio of gender in actors to actress in all the UK movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(IIF(T3.a_gender = 'M', 1, 0)) AS REAL) / SUM(IIF(T3.a_gender = 'F', 1, 0)) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T1.country = 'UK'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T3.a_gender = 'M', 1, 0)) AS REAL) / SUM(IIF(T3.a_gender = 'F', 1, 0)) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T1.country = 'UK'", "index": 1157, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUK is a country; Male actors mean that a_gender = 'M'; Female actors mean that a_gender = 'F'; ratio; ratio of gender in actors = count(a_gender = 'M') / a_gender = 'F'\nWhat's the ratio of gender in actors to actress in all the UK movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsecond newest movies refers to year = 2 since year in this database is a relative value, less is the newer\nHow many users have rated 1 each for the UK's second newest movies with a running time of 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.userid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'UK' AND T1.runningtime = 2 AND T2.rating = 1 AND T1.year = 2", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT COUNT(T2.userid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'UK' AND T1.runningtime = 2 AND T2.rating = 1 AND T1.year = 2", "index": 1158, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsecond newest movies refers to year = 2 since year in this database is a relative value, less is the newer\nHow many users have rated 1 each for the UK's second newest movies with a running time of 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Comedy', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\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 unique directors with an average earnings of 2 and a quality of 3 have not made comedy films? List them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 3 AND T1.avg_revenue = 2 AND T2.genre != 'Comedy'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT DISTINCT T1.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 3 AND T1.avg_revenue = 2 AND T2.genre != 'Comedy'", "index": 1159, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Comedy', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\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 unique directors with an average earnings of 2 and a quality of 3 have not made comedy films? List them.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['M', 'F']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe worst actors means a_quality = 0; Men and male share the same meaning; men actors refers to a_gender = 'M'\nHow many of the worst actors are men and how many of the worst actors are women? Indicate your answer in ratio form.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(IIF(a_gender = 'M', 1, 0)) AS REAL) / SUM(IIF(a_gender = 'F', 1, 0)) FROM actors WHERE a_quality = 0", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(a_gender = 'M', 1, 0)) AS REAL) / SUM(IIF(a_gender = 'F', 1, 0)) FROM actors WHERE a_quality = 0", "index": 1160, "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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['M', 'F']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe worst actors means a_quality = 0; Men and male share the same meaning; men actors refers to a_gender = 'M'\nHow many of the worst actors are men and how many of the worst actors are women? Indicate your answer in ratio form.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost popular genre indicates that the genre has the most number of movies\nWhat is the most popular genre of film directed by directors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 genre FROM movies2directors GROUP BY genre ORDER BY COUNT(movieid) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT genre FROM movies2directors GROUP BY genre ORDER BY COUNT(movieid) DESC LIMIT 1", "index": 1161, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost popular genre indicates that the genre has the most number of movies\nWhat is the most popular genre of film directed by directors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nd_quality = 5 refers to the best directors, d_quality = 0 refers to the worst directors\nWhat are the most common film genres made by the worst directors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.genre FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 0 GROUP BY T2.genre ORDER BY COUNT(T2.movieid) DESC LIMIT 1", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.genre FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 0 GROUP BY T2.genre ORDER BY COUNT(T2.movieid) DESC LIMIT 1", "index": 1162, "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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nd_quality = 5 refers to the best directors, d_quality = 0 refers to the worst directors\nWhat are the most common film genres made by the worst directors?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFemale users mean that u_gender = 'F'\nWhich movies have received the greatest ratings from female users whose occupations fall within the category of 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 T2.movieid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.u_gender = 'F' AND T1.occupation = 3 AND T2.rating = 5", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT T2.movieid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.u_gender = 'F' AND T1.occupation = 3 AND T2.rating = 5", "index": 1163, "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 directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['F', 'T']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFemale users mean that u_gender = 'F'\nWhich movies have received the greatest ratings from female users whose occupations fall within the category of 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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale actresses mean that a_gender = 'F'\nHow many female actresses appeared in the movie 2312852, what country was it in, and what was it's running time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.a_gender = 'F', 1, 0)) , T3.country, T3.runningtime FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T2.movieid = 2312852 GROUP BY T3.country, T3.runningtime", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT SUM(IIF(T1.a_gender = 'F', 1, 0)) , T3.country, T3.runningtime FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T2.movieid = 2312852 GROUP BY T3.country, T3.runningtime", "index": 1164, "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 u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale actresses mean that a_gender = 'F'\nHow many female actresses appeared in the movie 2312852, what country was it in, and what was it's running time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Comedy', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUK is a country\nAmong the English comedy movies produced in the UK, how many movies with a running time of 3 was rated the highest by users between the age 45-50? Indicate the movie names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.movieid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN u2base AS T3 ON T1.movieid = T3.movieid INNER JOIN users AS T4 ON T3.userid = T4.userid WHERE T1.country = 'UK' AND T2.genre = 'Comedy' AND T1.runningtime = 3 AND T3.rating = 5 AND T4.age BETWEEN 45 AND 50 AND T1.isEnglish = 'T'", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT DISTINCT T1.movieid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN u2base AS T3 ON T1.movieid = T3.movieid INNER JOIN users AS T4 ON T3.userid = T4.userid WHERE T1.country = 'UK' AND T2.genre = 'Comedy' AND T1.runningtime = 3 AND T3.rating = 5 AND T4.age BETWEEN 45 AND 50 AND T1.isEnglish = 'T'", "index": 1165, "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 movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n rating text, -- example: ['1', '2']\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Comedy', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['UK', 'other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n PRIMARY KEY (actorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUK is a country\nAmong the English comedy movies produced in the UK, how many movies with a running time of 3 was rated the highest by users between the age 45-50? Indicate the movie names.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Other', 'Crime', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon-English-language refers to isEnglish = 'F'; The percentage difference can be computed by [count(isEnglish = 'T' in movies) - count(isEnglish = 'F' in movies) / (all movies)] * 100%\nWhat is the percentage difference of English and non-English-language crime movies in other countries in year 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 CAST(SUM(IIF(T1.isEnglish = 'T', 1, 0)) - SUM(IIF(T1.isEnglish = 'F', 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'other' AND T1.year = 3", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT CAST(SUM(IIF(T1.isEnglish = 'T', 1, 0)) - SUM(IIF(T1.isEnglish = 'F', 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'other' AND T1.year = 3", "index": 1166, "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 users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['F', 'M']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n isEnglish text, -- example: ['T', 'F']\n country text, -- example: ['other', 'USA']\n runningtime integer, -- example: [2, 3]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Other', 'Crime', 'Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['F', 'M']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon-English-language refers to isEnglish = 'F'; The percentage difference can be computed by [count(isEnglish = 'T' in movies) - count(isEnglish = 'F' in movies) / (all movies)] * 100%\nWhat is the percentage difference of English and non-English-language crime movies in other countries in year 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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['M', 'F']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFemale actors mean that a_gender = 'F'; Male actors mean that a_gender = 'M'; a_quality = 5 refers to act the best, a_quality = 0 refers to act the worst\nWhat is the total amount male and female actors who were casted in movie ID 1684910 and what is the proportion between the highest quality actors against the worst quality of actors? Indicate your answer in percentage. List the the director as well as the genre.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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(a_gender = 'M', 1, 0)) , SUM(IIF(a_gender = 'F', 1, 0)) , CAST(SUM(IIF(a_quality = 5, 1, 0)) AS REAL) * 100 / COUNT(*) , CAST(SUM(IIF(a_quality = 0, 1, 0)) AS REAL) * 100 / COUNT(*), ( SELECT directorid FROM movies2directors WHERE movieid = 1684910 ) , ( SELECT genre FROM movies2directors WHERE movieid = 1684910 ) FROM actors WHERE actorid IN ( SELECT actorid FROM movies2actors WHERE movieid = 1684910 )", "style": "rule" }
{ "db_id": "movielens.sqlite", "gt_sql": "SELECT SUM(IIF(a_gender = 'M', 1, 0)) , SUM(IIF(a_gender = 'F', 1, 0)) , CAST(SUM(IIF(a_quality = 5, 1, 0)) AS REAL) * 100 / COUNT(*) , CAST(SUM(IIF(a_quality = 0, 1, 0)) AS REAL) * 100 / COUNT(*), ( SELECT directorid FROM movies2directors WHERE movieid = 1684910 ) , ( SELECT genre FROM movies2directors WHERE movieid = 1684910 ) FROM actors WHERE actorid IN ( SELECT actorid FROM movies2actors WHERE movieid = 1684910 )", "index": 1167, "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 actors (\n actorid integer, -- example: [4, 16]\n a_gender text, -- actor gender, example: ['M', 'F']\n a_quality integer, -- actor quality, example: [4, 0]\n PRIMARY KEY (actorid)\n);\n\nCREATE TABLE movies2directors (\n movieid integer, -- example: [1672052, 1672111]\n directorid integer, -- example: [22397, 54934]\n genre text, -- example: ['Action', 'Adventure']\n PRIMARY KEY (movieid, directorid)\n);\n\nCREATE TABLE u2base (\n userid integer, -- example: [1, 2]\n movieid integer, -- example: [1684486, 1685309]\n PRIMARY KEY (userid, movieid)\n);\n\nCREATE TABLE movies2actors (\n movieid integer, -- example: [1672052, 1672111]\n actorid integer, -- example: [88796, 88848]\n cast_num integer, -- cast number, example: [0, 1]\n PRIMARY KEY (movieid, actorid)\n);\n\nCREATE TABLE movies (\n movieid integer, -- example: [1672052, 1672111]\n `year` integer, -- example: [3, 4]\n PRIMARY KEY (movieid)\n);\n\nCREATE TABLE users (\n userid integer, -- example: [1, 2]\n age text, -- example: ['1', '56']\n u_gender text, -- user gender, example: ['M', 'F']\n occupation text, -- example: ['2', '3']\n PRIMARY KEY (userid)\n);\n\nCREATE TABLE directors (\n directorid integer, -- example: [7387, 12945]\n d_quality integer, -- director quality, example: [0, 1]\n avg_revenue integer, -- average revenue, example: [0, 1]\n PRIMARY KEY (directorid)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFemale actors mean that a_gender = 'F'; Male actors mean that a_gender = 'M'; a_quality = 5 refers to act the best, a_quality = 0 refers to act the worst\nWhat is the total amount male and female actors who were casted in movie ID 1684910 and what is the proportion between the highest quality actors against the worst quality of actors? Indicate your answer in percentage. List the the director as well as the genre.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Mode` text, -- example: ['Standard Class', 'Second Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade by Aimee Bixby refers to \"Customer Name\" = 'Aimee Bixby'; the slowest delivery speed refers to \"Ship Mode\" = 'Standard Class';\nAmong all the orders made by Aimee Bixby, how many of them chose the slowest delivery speed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aimee Bixby' AND T2.`Ship Mode` = 'Standard Class'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aimee Bixby' AND T2.`Ship Mode` = 'Standard Class'", "index": 1168, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Mode` text, -- example: ['Standard Class', 'Second Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade by Aimee Bixby refers to \"Customer Name\" = 'Aimee Bixby'; the slowest delivery speed refers to \"Ship Mode\" = 'Standard Class';\nAmong all the orders made by Aimee Bixby, how many of them chose the slowest delivery speed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAimee Bixby made refers to \"Customer Name\" = 'Aimee Bixby';\nHow many orders has Aimee Bixby made?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aimee Bixby'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aimee Bixby'", "index": 1169, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAimee Bixby made refers to \"Customer Name\" = 'Aimee Bixby';\nHow many orders has Aimee Bixby made?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade by Aimee Bixby refers to \"Customer Name\" = 'Aimee Bixby';\nAmong the orders made by Aimee Bixby, how many of them included at least one kind of product under the category \"Furniture\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T3.Category = 'Furniture' AND T1.`Customer Name` = 'Aimee Bixby'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T3.Category = 'Furniture' AND T1.`Customer Name` = 'Aimee Bixby'", "index": 1170, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade by Aimee Bixby refers to \"Customer Name\" = 'Aimee Bixby';\nAmong the orders made by Aimee Bixby, how many of them included at least one kind of product under the category \"Furniture\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Telescoping Adjustable Floor Lamp', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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\"Telescoping Adjustable Floor Lamp\" is a \"Product Name\"; from central superstores refers to Region = 'Central';\nWhat is the total quantity of \"Telescoping Adjustable Floor Lamp\" ordered from central superstores?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T1.Quantity) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Telescoping Adjustable Floor Lamp'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT SUM(T1.Quantity) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Telescoping Adjustable Floor Lamp'", "index": 1171, "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 central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Telescoping Adjustable Floor Lamp', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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\"Telescoping Adjustable Floor Lamp\" is a \"Product Name\"; from central superstores refers to Region = 'Central';\nWhat is the total quantity of \"Telescoping Adjustable Floor Lamp\" ordered from central superstores?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Telescoping Adjustable Floor Lamp', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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\"Telescoping Adjustable Floor Lamp\" is a product name; names of all the customers refers to \"Customer Name\"\nPlease list the names of all the customers who had ordered the product \"Telescoping Adjustable Floor Lamp\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Customer Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T3.`Product Name` = 'Telescoping Adjustable Floor Lamp'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T1.`Customer Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T3.`Product Name` = 'Telescoping Adjustable Floor Lamp'", "index": 1172, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Telescoping Adjustable Floor Lamp', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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\"Telescoping Adjustable Floor Lamp\" is a product name; names of all the customers refers to \"Customer Name\"\nPlease list the names of all the customers who had ordered the product \"Telescoping Adjustable Floor Lamp\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Telescoping Adjustable Floor Lamp', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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\"Telescoping Adjustable Floor Lamp\" is a \"Product Name\"; consumers refers to Segment = 'Consumer';\nAmong the customers who have ordered the product \"Telescoping Adjustable Floor Lamp\", how many of them are consumers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T1.`Customer Name`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T3.`Product Name` = 'Telescoping Adjustable Floor Lamp' AND T1.Segment = 'Consumer'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.`Customer Name`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T3.`Product Name` = 'Telescoping Adjustable Floor Lamp' AND T1.Segment = 'Consumer'", "index": 1173, "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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Telescoping Adjustable Floor Lamp', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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\"Telescoping Adjustable Floor Lamp\" is a \"Product Name\"; consumers refers to Segment = 'Consumer';\nAmong the customers who have ordered the product \"Telescoping Adjustable Floor Lamp\", how many of them are consumers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Xerox 1952', 'Xerox 1959', 'Xerox 1953', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nXerox 1952 is a \"Product Name\"; Aimee Bixby ordered refers to \"Customer Name\" = 'Aimee Bixby';\nFor how many times has Aimee Bixby ordered the product Xerox 1952?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Aimee Bixby' AND T3.`Product Name` = 'Xerox 1952'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Aimee Bixby' AND T3.`Product Name` = 'Xerox 1952'", "index": 1174, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Xerox 1952', 'Xerox 1959', 'Xerox 1953', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nXerox 1952 is a \"Product Name\"; Aimee Bixby ordered refers to \"Customer Name\" = 'Aimee Bixby';\nFor how many times has Aimee Bixby ordered the product Xerox 1952?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Xerox 1952', 'Xerox 1959', 'Xerox 1953', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2014-09-10', '2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2014-09-10', '2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2014-09-10', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nXerox 1952 is a \"Product Name\"; ordered by Aimee Bixby refers to \"Customer Name\" = 'Aimee Bixby'; on 2014/9/10 refers to \"Order Date\" = date('2014-09-10'); original price refers to DIVIDE(Sales, SUTRACT(1, discount))\nWhat was the original price of Xerox 1952 ordered by Aimee Bixby on 2014/9/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.Sales / (1 - T2.Discount) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Aimee Bixby' AND T3.`Product Name` = 'Xerox 1952' AND T2.`Order Date` = '2014-09-10'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T2.Sales / (1 - T2.Discount) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Aimee Bixby' AND T3.`Product Name` = 'Xerox 1952' AND T2.`Order Date` = '2014-09-10'", "index": 1175, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Xerox 1952', 'Xerox 1959', 'Xerox 1953', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2014-09-10', '2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2014-09-10', '2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Aimee Bixby', 'Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2014-09-10', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nXerox 1952 is a \"Product Name\"; ordered by Aimee Bixby refers to \"Customer Name\" = 'Aimee Bixby'; on 2014/9/10 refers to \"Order Date\" = date('2014-09-10'); original price refers to DIVIDE(Sales, SUTRACT(1, discount))\nWhat was the original price of Xerox 1952 ordered by Aimee Bixby on 2014/9/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 product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Art', 'Bookcases', 'Chairs']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered in 2013 refers to strftime('%Y', \"Order Date\") = '2013'; art products refers to \"Sub-Category\" = 'Art'\nHow many art products were ordered in 2013 in the east superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T1.`Product ID`) FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Sub-Category` = 'Art' AND T1.Region = 'East' AND STRFTIME('%Y', T1.`Order Date`) = '2013'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.`Product ID`) FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Sub-Category` = 'Art' AND T1.Region = 'East' AND STRFTIME('%Y', T1.`Order Date`) = '2013'", "index": 1176, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Art', 'Bookcases', 'Chairs']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered in 2013 refers to strftime('%Y', \"Order Date\") = '2013'; art products refers to \"Sub-Category\" = 'Art'\nHow many art products were ordered in 2013 in the east superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas the highest original price refers to MAX(DIVIDE(Sales, SUTRACT(1, discount))); name of the product refers to \"Product Name\"\nWhat is the name of the product that has the highest original price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` ORDER BY (T1.Sales / (1 - T1.Discount)) DESC LIMIT 1", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` ORDER BY (T1.Sales / (1 - T1.Discount)) DESC LIMIT 1", "index": 1177, "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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas the highest original price refers to MAX(DIVIDE(Sales, SUTRACT(1, discount))); name of the product refers to \"Product Name\"\nWhat is the name of the product that has the highest original price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Darren Powers', 'Alex Avila', 'Allen Armold']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDarren Powers is the \"Customer Name\"; name of the product refers to \"Product Name\"; recently refers to MAX(\"Order Date\")\nWhat is the name of the product that was ordered recently by Darren Powers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Darren Powers' ORDER BY T2.`Order Date` DESC LIMIT 1", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Darren Powers' ORDER BY T2.`Order Date` DESC LIMIT 1", "index": 1178, "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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Darren Powers', 'Alex Avila', 'Allen Armold']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDarren Powers is the \"Customer Name\"; name of the product refers to \"Product Name\"; recently refers to MAX(\"Order Date\")\nWhat is the name of the product that was ordered recently by Darren Powers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alejandro Grove', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered by Alejandro Grove refers to \"Customer Name\" = 'Alejandro Grove'; names of the products refers to \"Product Name\"\nWhat are the names of the products that were ordered by Alejandro Grove?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Alejandro Grove'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Alejandro Grove'", "index": 1179, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alejandro Grove', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered by Alejandro Grove refers to \"Customer Name\" = 'Alejandro Grove'; names of the products refers to \"Product Name\"\nWhat are the names of the products that were ordered by Alejandro Grove?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Cardinal EasyOpen D-Ring Binders', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Chicago', 'Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nat least 10 goods refers to Quantity > = 14; Cardinal EasyOpen D-Ring Binders refers to \"Product Name\"; customers in Chicago refers to City = 'Chicago'\nHow many customers in Chicago ordered at least 10 Cardinal EasyOpen D-Ring Binders in a single order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T1.`Customer ID`) FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Cardinal EasyOpen D-Ring Binders' AND T2.City = 'Chicago' AND T1.Quantity > 10", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.`Customer ID`) FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Cardinal EasyOpen D-Ring Binders' AND T2.City = 'Chicago' AND T1.Quantity > 10", "index": 1180, "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 south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Cardinal EasyOpen D-Ring Binders', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n City text, -- example: ['Chicago', 'Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nat least 10 goods refers to Quantity > = 14; Cardinal EasyOpen D-Ring Binders refers to \"Product Name\"; customers in Chicago refers to City = 'Chicago'\nHow many customers in Chicago ordered at least 10 Cardinal EasyOpen D-Ring Binders in a single order?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Becky Martin', 'Alex Avila', 'Allen Armold']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered by Becky Martin refers to \"Customer Name\" = 'Becky Martin'; Region = 'Central'; products refers to \"Product Name\"\nList the products ordered by Becky Martin around the Central region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Becky Martin' AND T3.Region = 'Central'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Becky Martin' AND T3.Region = 'Central'", "index": 1181, "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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Becky Martin', 'Alex Avila', 'Allen Armold']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered by Becky Martin refers to \"Customer Name\" = 'Becky Martin'; Region = 'Central'; products refers to \"Product Name\"\nList the products ordered by Becky Martin around the Central region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Patrick Gardner', 'Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPatrick Gardner is the \"Customer Name\"; Region = 'Central'\nAdd the total profit of Patrick Gardner in the Central region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T2.Profit) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Patrick Gardner' AND T1.Region = 'Central'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT SUM(T2.Profit) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Patrick Gardner' AND T1.Region = 'Central'", "index": 1182, "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 south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Patrick Gardner', 'Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPatrick Gardner is the \"Customer Name\"; Region = 'Central'\nAdd the total profit of Patrick Gardner in the Central region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Avery 5', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' is the \"Product Name\";\nWhat is the total sales of 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' in the Central region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(T1.Sales) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' AND T2.Region = 'Central'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT SUM(T1.Sales) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' AND T2.Region = 'Central'", "index": 1183, "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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Avery 5', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' is the \"Product Name\";\nWhat is the total sales of 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' in the Central region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Jonathan Doherty', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJonathan Doherty is the \"Customer Name\"; highest quantity refers to MAX(Quantity); Region = 'East'\nName the item ordered by Jonathan Doherty with the highest quantity in the East region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.`Product Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Jonathan Doherty' AND T2.Region = 'East' ORDER BY T1.Quantity DESC LIMIT 1", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T3.`Product Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Jonathan Doherty' AND T2.Region = 'East' ORDER BY T1.Quantity DESC LIMIT 1", "index": 1184, "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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Jonathan Doherty', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJonathan Doherty is the \"Customer Name\"; highest quantity refers to MAX(Quantity); Region = 'East'\nName the item ordered by Jonathan Doherty with the highest quantity in the East region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['South', 'Central']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Frank Olsen', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['South', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrank Olsen' is the \"Customer Name\"; Region = 'South'\nProvide the order ID of Frank Olsen of the South region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Order ID` FROM south_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.Region = 'South' AND T2.`Customer Name` = 'Frank Olsen'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T1.`Order ID` FROM south_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.Region = 'South' AND T2.`Customer Name` = 'Frank Olsen'", "index": 1185, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['South', 'Central']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Frank Olsen', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['South', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrank Olsen' is the \"Customer Name\"; Region = 'South'\nProvide the order ID of Frank Olsen of the South region.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2018-04-27', '2018-04-26', '2018-04-23', '2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non April 26, 2018 refers to \"Order Date\" = date('2018-04-26'); shipped by April 27, 2018 refers to \"Ship Date\" = date('2018-04-27');\nWhat product was ordered in the Central region on April 26, 2018, and shipped by April 27, 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order Date` = '2018-04-26' AND T1.`Ship Date` = '2018-04-27' AND T2.Region = 'Central'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order Date` = '2018-04-26' AND T1.`Ship Date` = '2018-04-27' AND T2.Region = 'Central'", "index": 1186, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2018-04-27', '2018-04-26', '2018-04-23', '2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2018-04-27', '2018-04-26', '2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non April 26, 2018 refers to \"Order Date\" = date('2018-04-26'); shipped by April 27, 2018 refers to \"Ship Date\" = date('2018-04-27');\nWhat product was ordered in the Central region on April 26, 2018, and shipped by April 27, 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest profit refers to MAX(profit); Region = 'East'\nWho is the customer from the East region that purchased the order with the highest profit?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'East' ORDER BY T1.Profit DESC LIMIT 1", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'East' ORDER BY T1.Profit DESC LIMIT 1", "index": 1187, "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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Region text, -- example: ['East', 'Central']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['East', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Quantity integer, -- example: [3, 9]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest profit refers to MAX(profit); Region = 'East'\nWho is the customer from the East region that purchased the order with the highest profit?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Office Supplies', 'Furniture']\n `Sub-Category` text, -- example: ['Supplies', 'Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade the highest sales refers to MAX(Sales)\nAmong the products under the office supplies category, what is the product that made the highest sales in the Central region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.Category = 'Office Supplies' AND T2.Region = 'Central' ORDER BY T1.Sales DESC LIMIT 1", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.Category = 'Office Supplies' AND T2.Region = 'Central' ORDER BY T1.Sales DESC LIMIT 1", "index": 1188, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Office Supplies', 'Furniture']\n `Sub-Category` text, -- example: ['Supplies', 'Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmade the highest sales refers to MAX(Sales)\nAmong the products under the office supplies category, what is the product that made the highest sales in the Central region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreceived the highest discount refers to MAX(discount); customer refers to \"Customer Name\"\nWho is the customer from the West region that received the highest discount?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Customer Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'West' ORDER BY T1.Discount DESC LIMIT 1", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T2.`Customer Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'West' ORDER BY T1.Discount DESC LIMIT 1", "index": 1189, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreceived the highest discount refers to MAX(discount); customer refers to \"Customer Name\"\nWho is the customer from the West region that received the highest discount?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost above 80000 refers to SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit) > 80000\nName the customers from the Eastern region whose orders cost above 80000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'East' AND T1.Sales / (1 - T1.Discount) * T1.Quantity - T1.Profit > 80000", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.Region = 'East' AND T1.Sales / (1 - T1.Discount) * T1.Quantity - T1.Profit > 80000", "index": 1190, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost above 80000 refers to SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit) > 80000\nName the customers from the Eastern region whose orders cost above 80000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Anne McFarland', 'Alex Avila', 'Allen Armold']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAnne McFarland' is the \"Customer Name\"; Western store refers to west_superstore; products refers to \"Product Name\"\nList the products that were ordered by Anne McFarland from the Western store.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Anne McFarland'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Anne McFarland'", "index": 1191, "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 central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Anne McFarland', 'Alex Avila', 'Allen Armold']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAnne McFarland' is the \"Customer Name\"; Western store refers to west_superstore; products refers to \"Product Name\"\nList the products that were ordered by Anne McFarland from the Western store.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Matt Abelman', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered by Matt Abelman refers to \"Customer Name\" = 'Matt Abelman'; in 2013 refers to \"Order Date\" like '2013%'\nList the products ordered by Matt Abelman from the Western store in 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Matt Abelman' AND STRFTIME('%Y', T1.`Order Date`) = '2013'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Matt Abelman' AND STRFTIME('%Y', T1.`Order Date`) = '2013'", "index": 1192, "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 central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Matt Abelman', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered by Matt Abelman refers to \"Customer Name\" = 'Matt Abelman'; in 2013 refers to \"Order Date\" like '2013%'\nList the products ordered by Matt Abelman from the Western store in 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Brad Thomas', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBrad Thomas is the \"Customer Name\"; in 2016 refers to strftime('%Y', \"Order Date\") = '2016'; total cost refers to SUM(SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit))\nCalculate the total cost of the orders by Brad Thomas in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM((T1.Sales / (1 - T1.Discount)) * T1.Quantity - T1.Profit) AS cost FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T1.`Product ID` = T3.`Product ID` AND T1.Region = T3.Region WHERE T1.Region = 'East' AND T2.`Customer Name` = 'Brad Thomas' AND strftime('%Y', T1.`Order Date`) = '2016'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT SUM((T1.Sales / (1 - T1.Discount)) * T1.Quantity - T1.Profit) AS cost FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T1.`Product ID` = T3.`Product ID` AND T1.Region = T3.Region WHERE T1.Region = 'East' AND T2.`Customer Name` = 'Brad Thomas' AND strftime('%Y', T1.`Order Date`) = '2016'", "index": 1193, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Brad Thomas', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBrad Thomas is the \"Customer Name\"; in 2016 refers to strftime('%Y', \"Order Date\") = '2016'; total cost refers to SUM(SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit))\nCalculate the total cost of the orders by Brad Thomas in 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Plantronics Single Ear Headset', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlantronics Single Ear Headset' is the \"Product Name\"; name refers to \"Customer Name\";\nProvide the names, cities, and countries of the customers who ordered the Plantronics single ear headset.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Customer Name`, T2.City, T2.Country FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Plantronics Single Ear Headset'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T2.`Customer Name`, T2.City, T2.Country FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Plantronics Single Ear Headset'", "index": 1194, "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 `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Plantronics Single Ear Headset', 'Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n Country text, -- example: ['United States']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlantronics Single Ear Headset' is the \"Product Name\"; name refers to \"Customer Name\";\nProvide the names, cities, and countries of the customers who ordered the Plantronics single ear headset.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-12-31', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-12-31', '2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Same Day', 'Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-12-31', '2013-01-09', '2013-01-07', '2013-01-04', '2013-01-03']\n `Ship Date` date, -- example: ['2013-12-31', '2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Same Day', 'Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-12-31', '2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-12-31', '2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Same Day', 'Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['Same Day', 'First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of all products refers to Product Name; same-day shipment refers to \"Ship Mode\" = 'Same Day'; year 2013 refers to \"Ship Date\" BETWEEN '2013-01-01' AND '2013-12-31'\nList the name of all products in the west superstore that customers chose for same-day shipment in the year 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Product Name` FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Same Day' AND T1.`Ship Date` LIKE '2013%'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T2.`Product Name` FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Same Day' AND T1.`Ship Date` LIKE '2013%'", "index": 1195, "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 west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-12-31', '2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-12-31', '2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Same Day', 'Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-12-31', '2013-01-09', '2013-01-07', '2013-01-04', '2013-01-03']\n `Ship Date` date, -- example: ['2013-12-31', '2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Same Day', 'Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n `Sub-Category` text, -- example: ['Bookcases', 'Chairs']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-12-31', '2013-01-05', '2013-01-11']\n `Ship Date` date, -- example: ['2013-12-31', '2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Same Day', 'Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n Discount real, -- example: [0.2, 0.0]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['Same Day', 'First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n City text, -- example: ['Round Rock', 'Omaha']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of all products refers to Product Name; same-day shipment refers to \"Ship Mode\" = 'Same Day'; year 2013 refers to \"Ship Date\" BETWEEN '2013-01-01' AND '2013-12-31'\nList the name of all products in the west superstore that customers chose for same-day shipment in the year 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Sam Craven', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'East', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat product category that Sam Craven ordered from the central and east superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 T3.Category FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` LEFT JOIN central_superstore AS T4 ON T3.`Product ID` = T4.`Product ID` WHERE T2.`Customer Name` = 'Sam Craven'", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T3.Category FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` LEFT JOIN central_superstore AS T4 ON T3.`Product ID` = T4.`Product ID` WHERE T2.`Customer Name` = 'Sam Craven'", "index": 1196, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Discount real, -- example: [0.2, 0.0]\n Profit real, -- example: [4.884, 3.0814]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Sam Craven', 'Alex Avila', 'Allen Armold']\n Segment text, -- example: ['Consumer', 'Home Office']\n State text, -- example: ['Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order ID` text, -- example: ['CA-2011-130813', 'CA-2011-157147']\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Discount real, -- example: [0.0, 0.15]\n Profit real, -- example: [9.3312, 238.653]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['Central', 'East', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat product category that Sam Craven ordered from the central and east superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Mode` text, -- example: ['Standard Class', 'Second Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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 of all the products refers to Product Name; order quantities greater than or equal to 10 refers to COUNT(\"Order ID\") > = 10; slowest delivery refers to \"Ship Mode\" = 'Standard Class'\nList the name of all the products with order quantities greater than or equal to 10 in the central superstore that has been shipped by the slowest delivery method.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Standard Class' AND T1.Quantity >= 10", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT DISTINCT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Standard Class' AND T1.Quantity >= 10", "index": 1197, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order ID` text, -- example: ['CA-2011-103800', 'CA-2011-112326']\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Quantity integer, -- example: [2, 3]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Mode` text, -- example: ['Standard Class', 'Second Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-10']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Quantity integer, -- example: [3, 9]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product 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 of all the products refers to Product Name; order quantities greater than or equal to 10 refers to COUNT(\"Order ID\") > = 10; slowest delivery refers to \"Ship Mode\" = 'Standard Class'\nList the name of all the products with order quantities greater than or equal to 10 in the central superstore that has been shipped by the slowest delivery method.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast sales refers to Sales = MIN(Sales)\nWhat product category got the least sales in the west superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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.Category FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` ORDER BY T1.Sales LIMIT 1", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT T2.Category FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` ORDER BY T1.Sales LIMIT 1", "index": 1198, "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 people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n State text, -- example: ['Texas', 'Nebraska']\n Region text, -- example: ['West', 'Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Sales real, -- example: [16.448, 11.784]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n Category text, -- example: ['Furniture', 'Office Supplies']\n Region text, -- example: ['West', 'Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order ID` text, -- example: ['CA-2011-141817', 'CA-2011-130092']\n `Ship Date` date, -- example: ['2013-01-12', '2013-01-14']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n Sales real, -- example: [19.536, 9.94]\n Quantity integer, -- example: [3, 2]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nleast sales refers to Sales = MIN(Sales)\nWhat product category got the least sales in the west superstore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n State text, -- example: ['Indiana', 'Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlive in Texas refers to State = 'Texas'; live in Indiana refers to State = 'Indiana'; Ratio = divide(sum(State = 'Texas'), sum(State = 'Indiana'))\nWhat is the ratio between customers who live in Texas and customers who live in Indiana?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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 State = 'Texas' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN State = 'Indiana' THEN 1 ELSE 0 END) FROM people", "style": "rule" }
{ "db_id": "superstore.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN State = 'Texas' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN State = 'Indiana' THEN 1 ELSE 0 END) FROM people", "index": 1199, "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 east_superstore (\n `Row ID` integer, -- example: [4647, 4648]\n `Order Date` date, -- example: ['2013-01-05', '2013-01-11']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['MB-18085', 'SV-20365']\n Region text, -- example: ['East']\n `Product ID` text, -- example: ['OFF-AR-10003478', 'FUR-FU-10000010']\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_east_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_east_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_east_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE west_superstore (\n `Row ID` integer, -- example: [13583, 13584]\n `Order Date` date, -- example: ['2013-01-06', '2013-01-13']\n `Ship Date` date, -- example: ['2013-01-08', '2013-01-18']\n `Ship Mode` text, -- example: ['Second Class', 'Standard Class']\n `Customer ID` text, -- example: ['LS-17230', 'BD-11605']\n Region text, -- example: ['West']\n `Product ID` text, -- example: ['OFF-PA-10002005', 'OFF-ST-10000078']\n Sales real, -- example: [19.44, 1325.85]\n Quantity integer, -- example: [3, 5]\n Discount real, -- example: [0.0, 0.15]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_west_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_west_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_west_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE product (\n `Product ID` text, -- example: ['FUR-BO-10000112', 'FUR-BO-10000330']\n `Product Name` text, -- example: ['Sauder Camden County Barrister Bookcase,', 'Sauder Inglewood Library Bookcases']\n Region text, -- example: ['Central', 'South']\n PRIMARY KEY (`Product ID`, Region)\n);\n\nCREATE TABLE people (\n `Customer ID` text, -- example: ['AA-10315', 'AA-10375']\n `Customer Name` text, -- example: ['Alex Avila', 'Allen Armold']\n Country text, -- example: ['United States']\n State text, -- example: ['Indiana', 'Texas', 'Nebraska']\n `Postal Code` integer, -- example: [78664, 68104]\n Region text, -- example: ['Central', 'East']\n PRIMARY KEY (`Customer ID`, Region)\n);\n\nCREATE TABLE central_superstore (\n `Row ID` integer, -- example: [1, 2]\n `Order Date` date, -- example: ['2013-01-03', '2013-01-04']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-08']\n `Ship Mode` text, -- example: ['Standard Class', 'First Class']\n `Customer ID` text, -- example: ['DP-13000', 'PO-19195']\n Region text, -- example: ['Central']\n `Product ID` text, -- example: ['OFF-PA-10000174', 'OFF-LA-10003223']\n Discount real, -- example: [0.2, 0.8]\n Profit real, -- example: [5.5512, 4.2717]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_central_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_central_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_central_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\n\nCREATE TABLE south_superstore (\n `Row ID` integer, -- example: [10343, 10344]\n `Order ID` text, -- example: ['CA-2011-106054', 'CA-2011-167199']\n `Ship Date` date, -- example: ['2013-01-07', '2013-01-10']\n `Ship Mode` text, -- example: ['First Class', 'Standard Class']\n `Customer ID` text, -- example: ['JO-15145', 'ME-17320']\n Region text, -- example: ['South']\n `Product ID` text, -- example: ['OFF-AR-10002399', 'FUR-CH-10004063']\n Sales real, -- example: [12.78, 2573.82]\n Discount real, -- example: [0.0, 0.7]\n Profit real, -- example: [5.2398, 746.4078]\n PRIMARY KEY (`Row ID`),\n CONSTRAINT fk_south_superstore_customer_id FOREIGN KEY (`Customer ID`) REFERENCES people (`Customer ID`),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES product (Region),\n CONSTRAINT fk_south_superstore_region FOREIGN KEY (Region) REFERENCES people (Region),\n CONSTRAINT fk_south_superstore_product_id FOREIGN KEY (`Product ID`) REFERENCES product (`Product ID`)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlive in Texas refers to State = 'Texas'; live in Indiana refers to State = 'Indiana'; Ratio = divide(sum(State = 'Texas'), sum(State = 'Indiana'))\nWhat is the ratio between customers who live in Texas and customers who live in Indiana?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\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" }