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 population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Uganda', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Uganda', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Uganda', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Uganda', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUganda is one of country names\nWhen did Uganda declare independence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Uganda'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Uganda'", "index": 3900, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Uganda', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Uganda', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Uganda', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Uganda', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUganda is one of country names\nWhen did Uganda declare independence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Uganda', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Uganda', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Uganda', 'Iran', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Uganda', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Uganda', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Uganda', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUganda is one of country names\nWhat kind of government does Iran have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Government FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Iran'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Government FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Iran'", "index": 3901, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Uganda', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Uganda', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Uganda', 'Iran', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Uganda', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Uganda', 'Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Uganda', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Uganda', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nUganda is one of country names\nWhat kind of government does Iran have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\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 rivers finally flows to the sea of 459m in depth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM river WHERE Sea IN ( SELECT Name FROM sea WHERE Depth = 459 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(*) FROM river WHERE Sea IN ( SELECT Name FROM sea WHERE Depth = 459 )", "index": 3902, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\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 rivers finally flows to the sea of 459m in depth?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\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 area of the country which became independent in 1921/3/13?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Area FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.Independence = '1921-03-13'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Area FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.Independence = '1921-03-13'", "index": 3903, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\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 area of the country which became independent in 1921/3/13?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Scottish', 'English', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['United Kingdom', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['English', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEnglish and Scottish are two languages; United Kingdom is a country\nHow many more people speak English than speak Scottish in United Kingdom?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T3.Population * (T2.Percentage - T1.Percentage) FROM ethnicGroup AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Country = T2.Country INNER JOIN country AS T3 ON T1.Country = T3.Code WHERE T1.Name = 'Scottish' AND T2.Name = 'English' AND T3.Name = 'United Kingdom'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T3.Population * (T2.Percentage - T1.Percentage) FROM ethnicGroup AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Country = T2.Country INNER JOIN country AS T3 ON T1.Country = T3.Code WHERE T1.Name = 'Scottish' AND T2.Name = 'English' AND T3.Name = 'United Kingdom'", "index": 3904, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Scottish', 'English', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['United Kingdom', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['English', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEnglish and Scottish are two languages; United Kingdom is a country\nHow many more people speak English than speak Scottish in United Kingdom?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\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 the capital cities of the countries that have more than 4 mountains.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Capital FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T1.Capital HAVING COUNT(T1.Name) > 4", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Capital FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T1.Capital HAVING COUNT(T1.Name) > 4", "index": 3905, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\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 the capital cities of the countries that have more than 4 mountains.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\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 mountains are there in the country with the greatest 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 COUNT(T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY T1.Population DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY T1.Population DESC LIMIT 1", "index": 3906, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\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 mountains are there in the country with the greatest 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 mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the countries whose agriculture takes up more than 40% of its GDP, how many of them have less than 2 mountains?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.Country) FROM ( SELECT T1.Country FROM economy AS T1 INNER JOIN geo_mountain AS T2 ON T1.Country = T2.Country WHERE T1.Industry < 40 GROUP BY T1.Country HAVING COUNT(T1.Country) < 2 ) AS T3", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(T3.Country) FROM ( SELECT T1.Country FROM economy AS T1 INNER JOIN geo_mountain AS T2 ON T1.Country = T2.Country WHERE T1.Industry < 40 GROUP BY T1.Country HAVING COUNT(T1.Country) < 2 ) AS T3", "index": 3907, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the countries whose agriculture takes up more than 40% of its GDP, how many of them have less than 2 mountains?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\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 the mountains in the country with the lowest inflation 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 Mountain FROM geo_mountain WHERE Country = ( SELECT Country FROM economy ORDER BY Inflation ASC LIMIT 1 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Mountain FROM geo_mountain WHERE Country = ( SELECT Country FROM economy ORDER BY Inflation ASC LIMIT 1 )", "index": 3908, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\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 the mountains in the country with the lowest inflation 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 locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich mountain is the highest in an independent country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T4.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN geo_mountain AS T3 ON T3.Country = T2.Country INNER JOIN mountain AS T4 ON T4.Name = T3.Mountain WHERE T2.Independence IS NOT NULL ORDER BY T4.Height DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T4.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN geo_mountain AS T3 ON T3.Country = T2.Country INNER JOIN mountain AS T4 ON T4.Name = T3.Mountain WHERE T2.Independence IS NOT NULL ORDER BY T4.Height DESC LIMIT 1", "index": 3909, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich mountain is the highest in an independent country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\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 volcanic mountains are there in countries whose population is no more than 5000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.Name) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T3.Type = 'volcanic' AND T1.Population <= 5000000", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T3.Name) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T3.Type = 'volcanic' AND T1.Population <= 5000000", "index": 3910, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\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 volcanic mountains are there in countries whose population is no more than 5000000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the countries with a GDP of over 1000000, how many of them have mountains higher than 1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T1.Name) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country INNER JOIN economy AS T3 ON T3.Country = T1.Code INNER JOIN mountain AS T4 ON T4.Name = T2.Mountain WHERE T3.GDP > 1000000 AND T4.Height > 1000", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.Name) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country INNER JOIN economy AS T3 ON T3.Country = T1.Code INNER JOIN mountain AS T4 ON T4.Name = T2.Mountain WHERE T3.GDP > 1000000 AND T4.Height > 1000", "index": 3911, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the countries with a GDP of over 1000000, how many of them have mountains higher than 1000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\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 the countries that share the shortest border.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 ORDER BY T2.Length ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 ORDER BY T2.Length ASC LIMIT 1", "index": 3912, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\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 the countries that share the shortest border.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\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 mountains are there on the African Continent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T3.Name) FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent INNER JOIN province AS T4 ON T4.Country = T1.Code INNER JOIN geo_mountain AS T5 ON T5.Province = T4.Name WHERE T3.Name = 'European'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(T3.Name) FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent INNER JOIN province AS T4 ON T4.Country = T1.Code INNER JOIN geo_mountain AS T5 ON T5.Province = T4.Name WHERE T3.Name = 'European'", "index": 3913, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\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 mountains are there on the African Continent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['European', 'Europeans', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\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 countries on the European Continent has an infant mortality rate per thousand of over 100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name) FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent INNER JOIN population AS T4 ON T4.Country = T1.Code WHERE T3.Name = 'Europe' AND T4.Infant_Mortality < 100", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(T1.Name) FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent INNER JOIN population AS T4 ON T4.Country = T1.Code WHERE T3.Name = 'Europe' AND T4.Infant_Mortality < 100", "index": 3914, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['European', 'Europeans', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\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 countries on the European Continent has an infant mortality rate per thousand of over 100?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\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 percentage of agriculture of GDP in countries on the African Continent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T4.Agriculture) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Africa'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT AVG(T4.Agriculture) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Africa'", "index": 3915, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\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 percentage of agriculture of GDP in countries on the African Continent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\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 inflation rate of the biggest continent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T4.Inflation) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = ( SELECT Name FROM continent ORDER BY Area DESC LIMIT 1 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT AVG(T4.Inflation) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = ( SELECT Name FROM continent ORDER BY Area DESC LIMIT 1 )", "index": 3916, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\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 inflation rate of the biggest continent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Sumatra', 'Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Sumatra', 'Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Sumatra', 'Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Sumatra', 'Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Sumatra', 'Island', 'Svalbard']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSumatra is an island\nList all the cities in Sumatra and state the population of each city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T1.Population FROM city AS T1 INNER JOIN locatedOn AS T2 ON T1.Name = T2.City INNER JOIN island AS T3 ON T3.Name = T2.Island WHERE T3.Name = 'Sumatra'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T1.Population FROM city AS T1 INNER JOIN locatedOn AS T2 ON T1.Name = T2.City INNER JOIN island AS T3 ON T3.Name = T2.Island WHERE T3.Name = 'Sumatra'", "index": 3917, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Sumatra', 'Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Sumatra', 'Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Sumatra', 'Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Sumatra', 'Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Sumatra', 'Island', 'Svalbard']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSumatra is an island\nList all the cities in Sumatra and state the population of each city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Warwickshire', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Warwickshire', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Warwickshire', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWarwickshire is a province\nList all islands that are greater than the island on which Warwickshire is located.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Name FROM island WHERE Area > ( SELECT DISTINCT T3.Area FROM city AS T1 INNER JOIN locatedOn AS T2 ON T1.Name = T2.City INNER JOIN island AS T3 ON T3.Name = T2.Island WHERE T1.Province = 'Warwickshire' )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT DISTINCT Name FROM island WHERE Area > ( SELECT DISTINCT T3.Area FROM city AS T1 INNER JOIN locatedOn AS T2 ON T1.Name = T2.City INNER JOIN island AS T3 ON T3.Name = T2.Island WHERE T1.Province = 'Warwickshire' )", "index": 3918, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Warwickshire', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Warwickshire', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Warwickshire', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWarwickshire is a province\nList all islands that are greater than the island on which Warwickshire is located.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor island area less than 200, list the island name and city it belongs to.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name, T1.Name FROM city AS T1 INNER JOIN locatedOn AS T2 ON T1.Name = T2.City INNER JOIN island AS T3 ON T3.Name = T2.Island WHERE T3.Area < 200", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT DISTINCT T3.Name, T1.Name FROM city AS T1 INNER JOIN locatedOn AS T2 ON T1.Name = T2.City INNER JOIN island AS T3 ON T3.Name = T2.Island WHERE T3.Area < 200", "index": 3919, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor island area less than 200, list the island name and city it belongs to.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\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 all the cities and its city population for provinces with population more than 1000000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T1.Population FROM city AS T1 INNER JOIN province AS T2 ON T2.Name = T1.Province WHERE T2.Population > 1000000", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T1.Population FROM city AS T1 INNER JOIN province AS T2 ON T2.Name = T1.Province WHERE T2.Population > 1000000", "index": 3920, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\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 all the cities and its city population for provinces with population more than 1000000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['Northern', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Baltic Sea', 'Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Baltic Sea', 'Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Baltic Sea', 'Atlantic Ocean', 'Sea of Okhotsk']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Baltic Sea', 'Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Europe', 'Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Northern', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Baltic Sea', 'Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Northern', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Baltic Sea', 'Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBaltic Sea is a sea located in Northern Europe\nWhat is the average population for all cities location at Baltic Sea?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Population) FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN sea AS T3 ON T3.Name = T2.Sea WHERE T3.Name = 'Baltic Sea'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT AVG(T1.Population) FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN sea AS T3 ON T3.Name = T2.Sea WHERE T3.Name = 'Baltic Sea'", "index": 3921, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['Northern', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Baltic Sea', 'Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Baltic Sea', 'Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Baltic Sea', 'Atlantic Ocean', 'Sea of Okhotsk']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Baltic Sea', 'Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Europe', 'Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Northern', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Baltic Sea', 'Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Northern', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Baltic Sea', 'Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBaltic Sea is a sea located in Northern Europe\nWhat is the average population for all cities location at Baltic Sea?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Albania', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Albania', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Albania', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Albania', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Albania', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Albania', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Albania', 'Afghanistan']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Albania', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Albania', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nState the name of the lake in Albania province and in which city does it located at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Lake, City FROM located WHERE Province = 'Albania' AND Lake IS NOT NULL", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Lake, City FROM located WHERE Province = 'Albania' AND Lake IS NOT NULL", "index": 3922, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Albania', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Albania', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Albania', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Albania', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Albania', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Albania', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Albania', 'Afghanistan']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Albania', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Albania', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nState the name of the lake in Albania province and in which city does it located at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the mountains that are volcanic along with its longitude and latitude.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name, Latitude, Longitude FROM mountain WHERE Type = 'volcano'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name, Latitude, Longitude FROM mountain WHERE Type = 'volcano'", "index": 3923, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the mountains that are volcanic along with its longitude and latitude.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName all the volcano mountains between the height of 2000 to 4000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name FROM mountain WHERE Type = 'volcano' AND Height BETWEEN 2000 AND 4000", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name FROM mountain WHERE Type = 'volcano' AND Height BETWEEN 2000 AND 4000", "index": 3924, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName all the volcano mountains between the height of 2000 to 4000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Mediterranean Sea', 'Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Mediterranean Sea', 'Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Mediterranean Sea', 'Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Mediterranean Sea', 'Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Mediterranean Sea', 'Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Mediterranean Sea', 'Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease state the longest river that flows to the Mediterranean Sea.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name FROM river WHERE Sea = 'Mediterranean Sea' ORDER BY Length DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name FROM river WHERE Sea = 'Mediterranean Sea' ORDER BY Length DESC LIMIT 1", "index": 3925, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Mediterranean Sea', 'Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Mediterranean Sea', 'Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Mediterranean Sea', 'Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Mediterranean Sea', 'Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Mediterranean Sea', 'Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Mediterranean Sea', 'Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPlease state the longest river that flows to the Mediterranean Sea.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAtlantic Ocean is the second-largest ocean on Earth, after the Pacific Ocean; Ocean and sea share the same meaning\nList all the cities and provinces located at the rivers that flows to Atlantic Ocean.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T1.Province FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Sea = 'Atlantic Ocean'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T1.Province FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Sea = 'Atlantic Ocean'", "index": 3926, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Atlantic Ocean', 'Pacific Ocean', 'Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAtlantic Ocean is the second-largest ocean on Earth, after the Pacific Ocean; Ocean and sea share the same meaning\nList all the cities and provinces located at the rivers that flows to Atlantic Ocean.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Lorraine', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Lorraine', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Lorraine', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Lorraine', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Lorraine', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Lorraine', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Lorraine', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLorraine is a province\nName the river of which Lorraine is on. Please name the mountains where to source flow from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SourceLongitude, T1.SourceLatitude, T1.SourceAltitude FROM river AS T1 INNER JOIN geo_river AS T2 ON T2.River = T1.Name WHERE T2.Province = 'Lorraine'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.SourceLongitude, T1.SourceLatitude, T1.SourceAltitude FROM river AS T1 INNER JOIN geo_river AS T2 ON T2.River = T1.Name WHERE T2.Province = 'Lorraine'", "index": 3927, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Lorraine', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Lorraine', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Lorraine', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Lorraine', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Lorraine', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Lorraine', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Lorraine', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLorraine is a province\nName the river of which Lorraine is on. Please name the mountains where to source flow from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Blue Nile', 'Nile', 'Aare', 'Adda']\n River text, -- example: ['Nile', 'Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Blue Nile', 'Nile', 'Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'Donau']\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich mountain does the river source Blue Nile located? State the height of the mountain.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T1.Height FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN geo_source AS T4 ON T4.Province = T3.Name WHERE T4.River = 'Blue Nile'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T1.Height FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN geo_source AS T4 ON T4.Province = T3.Name WHERE T4.River = 'Blue Nile'", "index": 3928, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Blue Nile', 'Nile', 'Aare', 'Adda']\n River text, -- example: ['Nile', 'Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Blue Nile', 'Nile', 'Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'Donau']\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Blue Nile', 'River', 'Nile', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich mountain does the river source Blue Nile located? State the height of the mountain.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Little Rock', 'Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Little Rock', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the river at Little Rock city. State the length of the river.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Length FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T1.Name = 'Little Rock'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T3.Length FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T1.Name = 'Little Rock'", "index": 3929, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Little Rock', 'Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Little Rock', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the river at Little Rock city. State the length of the river.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all rivers and province it is located that is greater than 1000 in length.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Province, T2.Name FROM geo_river AS T1 INNER JOIN river AS T2 ON T1.River = T2.Name WHERE T2.Length > 1000", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Province, T2.Name FROM geo_river AS T1 INNER JOIN river AS T2 ON T1.River = T2.Name WHERE T2.Length > 1000", "index": 3930, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all rivers and province it is located that is greater than 1000 in length.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Moldoveanu', 'Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMoldoveanu is a mountain\nIn which province and country does Moldoveanu located? State its height.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Province, T2.Country, T1.Height FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain WHERE T1.Name = 'Moldoveanu'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Province, T2.Country, T1.Height FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain WHERE T1.Name = 'Moldoveanu'", "index": 3931, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Moldoveanu', 'Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMoldoveanu is a mountain\nIn which province and country does Moldoveanu located? State its height.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['USA', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['USA', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['USA', 'A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['USA', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['USA', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['USA', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['USA', 'Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['USA', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['USA', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['USA', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\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\nProvide all rivers name and length in 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 DISTINCT T3.Name, T3.Length FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T2.Country = 'USA'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT DISTINCT T3.Name, T3.Length FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T2.Country = 'USA'", "index": 3932, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['USA', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['USA', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['USA', 'A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['USA', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['USA', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['USA', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['USA', 'Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['USA', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['USA', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['USA', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\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\nProvide all rivers name and length in 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 river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Nepal', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Nepal', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Nepal', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Nepal', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nepal', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Nepal', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Nepal', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNepal is a province\nWhat is the average height of all mountains in Nepal?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Height) FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain WHERE T2.Province = 'Nepal'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT AVG(T1.Height) FROM mountain AS T1 INNER JOIN geo_mountain AS T2 ON T1.Name = T2.Mountain WHERE T2.Province = 'Nepal'", "index": 3933, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Nepal', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Nepal', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Nepal', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Nepal', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nepal', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Nepal', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Nepal', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNepal is a province\nWhat is the average height of all mountains in Nepal?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Belgrade', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Belgrade', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Belgrade', 'Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Belgrade', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich are the 2 rivers located at Belgrade city? Which river is longer and how by much?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T1.Length FROM river AS T1 INNER JOIN located AS T2 ON T1.Name = T2.River INNER JOIN city AS T3 ON T3.Name = T2.City WHERE T3.Name = 'Belgrade'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T1.Length FROM river AS T1 INNER JOIN located AS T2 ON T1.Name = T2.River INNER JOIN city AS T3 ON T3.Name = T2.City WHERE T3.Name = 'Belgrade'", "index": 3934, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Belgrade', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Belgrade', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Belgrade', 'Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Belgrade', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich are the 2 rivers located at Belgrade city? Which river is longer and how by much?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich countries are dependent on the British Crown?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Country FROM politics WHERE Government = 'British crown dependency'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Country FROM politics WHERE Government = 'British crown dependency'", "index": 3935, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich countries are dependent on the British Crown?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Canada', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\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 names of the rivers in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.River FROM located AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Canada' AND T1.River IS NOT NULL", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT DISTINCT T1.River FROM located AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Canada' AND T1.River IS NOT NULL", "index": 3936, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Canada', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\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 names of the rivers in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInflation can reduce purchasing power over time for recipients and payers.\nWhat is the name of the country whose citizens have the lowest purchasing power?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Name FROM economy AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code ORDER BY T1.Inflation DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Name FROM economy AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code ORDER BY T1.Inflation DESC LIMIT 1", "index": 3937, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInflation can reduce purchasing power over time for recipients and payers.\nWhat is the name of the country whose citizens have the lowest purchasing power?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Asian', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia is a continent\nWhat is the average area of Asian countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Area) FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country WHERE T2.Continent = 'Asia'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT AVG(Area) FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country WHERE T2.Continent = 'Asia'", "index": 3938, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Asian', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia is a continent\nWhat is the average area of Asian countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\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 mountains are there in the country with the most land area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Mountain) FROM geo_mountain WHERE Country = ( SELECT Code FROM country ORDER BY Area DESC LIMIT 1 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(Mountain) FROM geo_mountain WHERE Country = ( SELECT Code FROM country ORDER BY Area DESC LIMIT 1 )", "index": 3939, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\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 mountains are there in the country with the most land area?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nShallow sea refers to the sea with less depth\nWhich sea is the shallowest and which country surrounds it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T2.Name FROM located AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE Sea = ( SELECT Name FROM sea ORDER BY Depth ASC LIMIT 1 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT DISTINCT T2.Name FROM located AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE Sea = ( SELECT Name FROM sea ORDER BY Depth ASC LIMIT 1 )", "index": 3940, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nShallow sea refers to the sea with less depth\nWhich sea is the shallowest and which country surrounds it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\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 smallest border's length, and what form of government do the two nations bordering it have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Government, T3.Government FROM politics AS T1 INNER JOIN borders AS T2 ON T1.Country = T2.Country1 INNER JOIN politics AS T3 ON T3.Country = T2.Country2 ORDER BY T2.Length ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Government, T3.Government FROM politics AS T1 INNER JOIN borders AS T2 ON T1.Country = T2.Country1 INNER JOIN politics AS T3 ON T3.Country = T2.Country2 ORDER BY T2.Length ASC LIMIT 1", "index": 3941, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\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 smallest border's length, and what form of government do the two nations bordering it have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Arabic', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Arab', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArabic-speaking country = country that speaks 100% Arabic\nWhich Arabic-speaking country has the smallest 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 T1.Name FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Arabic' AND T2.Percentage = 100 ORDER BY T1.Population ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Arabic' AND T2.Percentage = 100 ORDER BY T1.Population ASC LIMIT 1", "index": 3942, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Arabic', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Arab', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArabic-speaking country = country that speaks 100% Arabic\nWhich Arabic-speaking country has the smallest 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 lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\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 lakes are there in the 4th most populous African country with a republican form of government?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM geo_lake WHERE Country = ( SELECT T4.Code FROM ( SELECT T2.Code, T2.Population FROM encompasses AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code INNER JOIN politics AS T3 ON T1.Country = T3.Country WHERE T1.Continent = 'Africa' AND T1.Percentage = 100 AND T3.Government = 'republic' ORDER BY Population DESC LIMIT 4 ) AS T4 ORDER BY population ASC LIMIT 1 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(*) FROM geo_lake WHERE Country = ( SELECT T4.Code FROM ( SELECT T2.Code, T2.Population FROM encompasses AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code INNER JOIN politics AS T3 ON T1.Country = T3.Country WHERE T1.Continent = 'Africa' AND T1.Percentage = 100 AND T3.Government = 'republic' ORDER BY Population DESC LIMIT 4 ) AS T4 ORDER BY population ASC LIMIT 1 )", "index": 3943, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\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 lakes are there in the 4th most populous African country with a republican form of government?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost prevalent religion refers to the religion with the most population percentage\nWhich religion is most prevalent in Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T4.Name FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN religion AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Asia' GROUP BY T4.Name ORDER BY SUM(T4.Percentage) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T4.Name FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country INNER JOIN religion AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Asia' GROUP BY T4.Name ORDER BY SUM(T4.Percentage) DESC LIMIT 1", "index": 3944, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMost prevalent religion refers to the religion with the most population percentage\nWhich religion is most prevalent in Asia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Atlantic Ocean', 'Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Atlantic Ocean', 'Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Atlantic Ocean', 'Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Atlantic Ocean', 'Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Atlantic Ocean', 'Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Atlantic Ocean', 'Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEmpties into the Atlantic Ocean = flows to the Atlantic Ocean\nWhat are the names of the three nations where the longest river that empties into the Atlantic Ocean stretches to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Country FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Name = ( SELECT Name FROM river WHERE Sea = 'Atlantic Ocean' ORDER BY Length DESC LIMIT 1 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT DISTINCT T1.Country FROM city AS T1 INNER JOIN located AS T2 ON T1.Name = T2.City INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Name = ( SELECT Name FROM river WHERE Sea = 'Atlantic Ocean' ORDER BY Length DESC LIMIT 1 )", "index": 3945, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Atlantic Ocean', 'Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Atlantic Ocean', 'Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Atlantic Ocean', 'Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Atlantic Ocean', 'Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Atlantic Ocean', 'Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Atlantic Ocean', 'Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEmpties into the Atlantic Ocean = flows to the Atlantic Ocean\nWhat are the names of the three nations where the longest river that empties into the Atlantic Ocean stretches to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many people reside in the nation's capital city, which is situated in the nation that attained independence on 8/15/1947?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Population FROM politics AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code INNER JOIN city AS T3 ON T3.Name = T2.Capital WHERE T1.Independence = '1947-08-15'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T3.Population FROM politics AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code INNER JOIN city AS T3 ON T3.Name = T2.Capital WHERE T1.Independence = '1947-08-15'", "index": 3946, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many people reside in the nation's capital city, which is situated in the nation that attained independence on 8/15/1947?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Euphrat', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Euphrat', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Euphrat', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n River text, -- example: ['Euphrat', 'Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Euphrat', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['Euphrat', 'River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\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 names of the cities along the Euphrat River's course? Indicate the capital city of the nation where the Euphrat River flows.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.City, T1.Capital FROM country AS T1 INNER JOIN located AS T2 ON T1.Code = T2.Country INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Name = 'Euphrat'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.City, T1.Capital FROM country AS T1 INNER JOIN located AS T2 ON T1.Code = T2.Country INNER JOIN river AS T3 ON T3.Name = T2.River WHERE T3.Name = 'Euphrat'", "index": 3947, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Euphrat', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Euphrat', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Euphrat', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n River text, -- example: ['Euphrat', 'Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Euphrat', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['Euphrat', 'River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\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 names of the cities along the Euphrat River's course? Indicate the capital city of the nation where the Euphrat River flows.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['federal republic', 'Government', 'republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Europe', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepublic is on of government forms; Percentage of Services of the GDP was mentioned in economy.Service; Population Density = Population / Area\nWhich federal republic country in Europe has the most provinces, and what proportion of GDP is devoted to services?\nCalculate the population density as well.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Country, T2.Service , SUM(T1.Population) / SUM(T1.Area) FROM province AS T1 INNER JOIN economy AS T2 ON T1.Country = T2.Country WHERE T1.Country IN ( SELECT Country FROM encompasses WHERE Continent = 'Europe' ) GROUP BY T1.Country, T2.Service ORDER BY COUNT(T1.Name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Country, T2.Service , SUM(T1.Population) / SUM(T1.Area) FROM province AS T1 INNER JOIN economy AS T2 ON T1.Country = T2.Country WHERE T1.Country IN ( SELECT Country FROM encompasses WHERE Continent = 'Europe' ) GROUP BY T1.Country, T2.Service ORDER BY COUNT(T1.Name) DESC LIMIT 1", "index": 3948, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['federal republic', 'Government', 'republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Europe', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRepublic is on of government forms; Percentage of Services of the GDP was mentioned in economy.Service; Population Density = Population / Area\nWhich federal republic country in Europe has the most provinces, and what proportion of GDP is devoted to services?\nCalculate the population density as well.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\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 capital of the 3rd most populated country in Asia and what is the capital city's ratio in percentage (%) against the overall population of the country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T4.Capital, CAST(T3.Population AS REAL) * 100 / T4.Population FROM city AS T3 INNER JOIN ( SELECT T1.Capital , T1.Population FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country WHERE T2.Continent = 'Asia' ORDER BY T1.Population DESC LIMIT 2, 1 ) AS T4 ON T3.Name = T4.Capital", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T4.Capital, CAST(T3.Population AS REAL) * 100 / T4.Population FROM city AS T3 INNER JOIN ( SELECT T1.Capital , T1.Population FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country WHERE T2.Continent = 'Asia' ORDER BY T1.Population DESC LIMIT 2, 1 ) AS T4 ON T3.Name = T4.Capital", "index": 3949, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\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 capital of the 3rd most populated country in Asia and what is the capital city's ratio in percentage (%) against the overall population of the country?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['MNE', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['MNE', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Main', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Main', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['MNE', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['MNE', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Main', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Main', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['MNE', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['MNE', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['MNE', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['MNE', 'A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['MNE', 'A', 'AFG']\n Country2 text, -- example: ['MNE', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMNE is one country\nWhat is the main spoken language in MNE?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name FROM language WHERE Country = 'MNE' ORDER BY Percentage DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name FROM language WHERE Country = 'MNE' ORDER BY Percentage DESC LIMIT 1", "index": 3950, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['MNE', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['MNE', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Main', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Main', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['MNE', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['MNE', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Main', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Main', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['MNE', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['MNE', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['MNE', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['MNE', 'A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['MNE', 'A', 'AFG']\n Country2 text, -- example: ['MNE', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMNE is one country\nWhat is the main spoken language in MNE?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_estuary (\n River text, -- example: ['Pjandsh', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['Pjandsh', 'River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Pjandsh', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Pjandsh', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Pjandsh', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country was the source of Pjandsh River? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN located AS T2 ON T1.Code = T2.Country WHERE T2.River = 'Pjandsh'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN located AS T2 ON T1.Code = T2.Country WHERE T2.River = 'Pjandsh'", "index": 3951, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_estuary (\n River text, -- example: ['Pjandsh', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['Pjandsh', 'River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Pjandsh', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Pjandsh', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Pjandsh', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country was the source of Pjandsh River? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['North', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['North', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['North', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['North', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['North', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['North', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbillion = 1000000000\nFor the countries have the population north of a billion, which one has the lowest GDP? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Population > 1000000000 ORDER BY T2.GDP ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Population > 1000000000 ORDER BY T2.GDP ASC LIMIT 1", "index": 3952, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['North', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['North', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['North', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['North', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['North', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['North', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbillion = 1000000000\nFor the countries have the population north of a billion, which one has the lowest GDP? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['1492-01-01', 'Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country became independent on 1492-01-01? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.Independence = '1492-01-01'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.Independence = '1492-01-01'", "index": 3953, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['1492-01-01', 'Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country became independent on 1492-01-01? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['France', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\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 cities in France have a population of more than 100,000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN city AS T2 ON T2.Country = T1.Code WHERE T1.Name = 'France' AND T2.Population > 100000", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN city AS T2 ON T2.Country = T1.Code WHERE T1.Name = 'France' AND T2.Population > 100000", "index": 3954, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['France', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\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 cities in France have a population of more than 100,000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong all the rivers finally flows to the sea of 540m in depth, which one has the longest length?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Name FROM sea AS T1 INNER JOIN river AS T2 ON T2.Sea = T1.Name WHERE T1.Depth = 540 ORDER BY T2.Length DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Name FROM sea AS T1 INNER JOIN river AS T2 ON T2.Sea = T1.Name WHERE T1.Depth = 540 ORDER BY T2.Length DESC LIMIT 1", "index": 3955, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong all the rivers finally flows to the sea of 540m in depth, which one has the longest length?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor all the countries that is smaller than 100 square kilometres, which one has the most GDP?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Area < 100 ORDER BY T2.GDP DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Area < 100 ORDER BY T2.GDP DESC LIMIT 1", "index": 3956, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor all the countries that is smaller than 100 square kilometres, which one has the most GDP?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Japan', 'Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Japan', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJapan is a country\nWhat is the total number of cities that Japan have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T3.Name) FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T1.Name = 'Japan'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT COUNT(T3.Name) FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T1.Name = 'Japan'", "index": 3957, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Japan', 'Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Japan', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJapan is a country\nWhat is the total number of cities that Japan have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Grozny', 'Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Grozny', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGrozny is a province\nIn which country is the city of Grozny? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name = 'Grozny'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN province AS T2 ON T1.Code = T2.Country INNER JOIN city AS T3 ON T3.Province = T2.Name WHERE T3.Name = 'Grozny'", "index": 3958, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Grozny', 'Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Grozny', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGrozny is a province\nIn which country is the city of Grozny? Give the full name of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich two countries have the border in length of 803 km? Give the full names of the countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T2.Length = 803", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T2.Length = 803", "index": 3959, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich two countries have the border in length of 803 km? Give the full names of the countries.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Europe', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Russia', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\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 percent of the total area of Russia is in Europe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Percentage FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Russia' AND T1.Name = 'Europe'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Percentage FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Russia' AND T1.Name = 'Europe'", "index": 3960, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Europe', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Russia', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\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 percent of the total area of Russia is in Europe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Equatorial Guinea', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Guinea', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Equatorial Guinea', 'Guinea', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Equatorial Guinea', 'Guinea', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Guinea', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Equatorial Guinea', 'Guinea', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Equatorial Guinea', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Equatorial Guinea', 'Guinea', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEquatorial Guinea is a country\nWhen did Equatorial Guinea become independent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Equatorial Guinea'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Equatorial Guinea'", "index": 3961, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Equatorial Guinea', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Guinea', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Equatorial Guinea', 'Guinea', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Equatorial Guinea', 'Guinea', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Guinea', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Equatorial Guinea', 'Guinea', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Equatorial Guinea', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Equatorial Guinea', 'Guinea', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEquatorial Guinea is a country\nWhen did Equatorial Guinea become independent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngreatest presence can be represented by largest percentage.\nIn countries where there is more than one ethnic group, name the ethnic group with the greatest presence in each country and the country to which it corresponds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Country, Name FROM ethnicGroup AS T1 WHERE Percentage < 100 AND Percentage = ( SELECT MAX(Percentage) FROM ethnicGroup AS T2 WHERE T1.Country = T2.Country )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Country, Name FROM ethnicGroup AS T1 WHERE Percentage < 100 AND Percentage = ( SELECT MAX(Percentage) FROM ethnicGroup AS T2 WHERE T1.Country = T2.Country )", "index": 3962, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngreatest presence can be represented by largest percentage.\nIn countries where there is more than one ethnic group, name the ethnic group with the greatest presence in each country and the country to which it corresponds.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\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 rivers belong to more than one country? Name the provinces where we can find 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 River, GROUP_CONCAT(Province) FROM geo_river GROUP BY River HAVING COUNT(DISTINCT Country) > 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT River, GROUP_CONCAT(Province) FROM geo_river GROUP BY River HAVING COUNT(DISTINCT Country) > 1", "index": 3963, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\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 rivers belong to more than one country? Name the provinces where we can find 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 isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Group of 2', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Lesser Antilles', 'Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercent = [count(non volcanic islands Lesser Antilles area 300 or less) / count(non volcanic islands Lesser Antilles)] * 100%\nWhat percent of the non volcanic islands in the Lesser Antilles group of islands have an area of no more than 300 square kilometers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN Area <= 300 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM island WHERE Islands = 'Lesser Antilles' AND (Type != 'volcanic' OR Type IS NULL)", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT SUM(CASE WHEN Area <= 300 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM island WHERE Islands = 'Lesser Antilles' AND (Type != 'volcanic' OR Type IS NULL)", "index": 3964, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Less', 'Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Group of 2', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Lesser Antilles', 'Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercent = [count(non volcanic islands Lesser Antilles area 300 or less) / count(non volcanic islands Lesser Antilles)] * 100%\nWhat percent of the non volcanic islands in the Lesser Antilles group of islands have an area of no more than 300 square kilometers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['English', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['English', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage = [count(countries 100% English) / count(countries English)] * 100%\nOf all the countries in which English is spoken, what percentage has English as their only language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T2.Percentage = 100 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Name) FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'English'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.Percentage = 100 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Name) FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'English'", "index": 3965, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['English', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['English', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage = [count(countries 100% English) / count(countries English)] * 100%\nOf all the countries in which English is spoken, what percentage has English as their only language?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which city is the lake located at coordinates longitude -85.35 and latitude 11.6?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.City FROM lake AS T1 INNER JOIN located AS T2 ON T1.Name = T2.Lake INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN city AS T4 ON T4.Province = T3.Name WHERE T1.Longitude = -85.35 AND T1.Latitude = 11.6", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.City FROM lake AS T1 INNER JOIN located AS T2 ON T1.Name = T2.Lake INNER JOIN province AS T3 ON T3.Name = T2.Province INNER JOIN city AS T4 ON T4.Province = T3.Name WHERE T1.Longitude = -85.35 AND T1.Latitude = 11.6", "index": 3966, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which city is the lake located at coordinates longitude -85.35 and latitude 11.6?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Manicouagan', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Manicouagan', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Manicouagan', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Manicouagan', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which lake flows the river that is, in turn, the mouth of the Manicouagan River?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT NAME FROM lake WHERE river = ( SELECT river FROM river WHERE NAME = 'Manicouagan' )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT NAME FROM lake WHERE river = ( SELECT river FROM river WHERE NAME = 'Manicouagan' )", "index": 3967, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Manicouagan', 'Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['Manicouagan', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['Manicouagan', 'River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['Manicouagan', 'River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which lake flows the river that is, in turn, the mouth of the Manicouagan River?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['Hindu', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio of people per square meter of surface = Population / Area\nOf all the countries of the Hindu religion, which has the lowest ratio of people per square meter of surface?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Hindu' ORDER BY T1.Population / T1.Area ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Hindu' ORDER BY T1.Population / T1.Area ASC LIMIT 1", "index": 3968, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['Hindu', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio of people per square meter of surface = Population / Area\nOf all the countries of the Hindu religion, which has the lowest ratio of people per square meter of surface?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Saint Kitts and Nevis', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Saint Kitts', 'Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Saint Kitts', 'Nevis', 'Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Saint Kitts', 'Nevis', 'Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Saint Kitts and Nevis', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Saint Kitts and Nevis', 'Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Saint Kitts and Nevis', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Saint Kitts and Nevis', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Saint Kitts and Nevis', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Saint Kitts and Nevis', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGDP refers to gross domestic product\nOn what date did the country have a gross domestic product 400% higher than Saint Kitts and Nevis become independent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Independence FROM politics WHERE country = ( SELECT country FROM economy WHERE GDP = 1100 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Independence FROM politics WHERE country = ( SELECT country FROM economy WHERE GDP = 1100 )", "index": 3969, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Saint Kitts and Nevis', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Saint Kitts', 'Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Saint Kitts', 'Nevis', 'Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Saint Kitts', 'Nevis', 'Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Saint Kitts and Nevis', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Saint Kitts and Nevis', 'Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Saint Kitts and Nevis', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Saint Kitts and Nevis', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Saint Kitts and Nevis', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Saint Kitts and Nevis', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGDP refers to gross domestic product\nOn what date did the country have a gross domestic product 400% higher than Saint Kitts and Nevis become independent?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAverage population ratio = Population / Area\nWhat is the average population ratio of the countries in which organizations were established in 1947?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Population / T1.Area FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE STRFTIME('%Y', T2.Established) = '1947'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Population / T1.Area FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE STRFTIME('%Y', T2.Established) = '1947'", "index": 3970, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE country (\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAverage population ratio = Population / Area\nWhat is the average population ratio of the countries in which organizations were established in 1947?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Anguilla', 'Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Anguilla', 'Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Anguilla', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Anguilla', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Anguilla', 'Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Anguilla', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Anguilla', 'Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Anguilla', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Anguilla', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAnguilla is a country\nWhat is the name of Anguilla's capital, and where is it located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Capital, Province FROM country WHERE Name = 'Anguilla'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Capital, Province FROM country WHERE Name = 'Anguilla'", "index": 3971, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Anguilla', 'Aland', 'Alicudi']\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Anguilla', 'Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Anguilla', 'Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Anguilla', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Anguilla', 'Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Anguilla', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Anguilla', 'Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Anguilla', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Anguilla', 'Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAnguilla is a country\nWhat is the name of Anguilla's capital, and where is it located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich nation has the smallest population, and where is its capital located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name, Capital FROM country ORDER BY Population ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name, Capital FROM country ORDER BY Population ASC LIMIT 1", "index": 3972, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich nation has the smallest population, and where is its capital located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Aarhus', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aarhus', 'Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLongitude, Latitude = coordinates of the location\nWhat is the geographic location of Aarhus city? Please provide the answer with the coordinates of the location.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Longitude, Latitude FROM city WHERE Name = 'Aarhus'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Longitude, Latitude FROM city WHERE Name = 'Aarhus'", "index": 3973, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Aarhus', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aarhus', 'Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLongitude, Latitude = coordinates of the location\nWhat is the geographic location of Aarhus city? Please provide the answer with the coordinates of the location.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['United Kingdom', 'Italy', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPopulation gap = Total population of the United Kingdom - Total population of Italy\nWhat is the population gap between the United Kingdom and Italy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(Population) - MIN(Population) FROM country WHERE Name = 'United Kingdom' OR Name = 'Italy'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT MAX(Population) - MIN(Population) FROM country WHERE Name = 'United Kingdom' OR Name = 'Italy'", "index": 3974, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['United Kingdom', 'Italy', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPopulation gap = Total population of the United Kingdom - Total population of Italy\nWhat is the population gap between the United Kingdom and Italy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['European', 'Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which city is the European Bank for Reconstruction and Development's headquarters? Please include the city and province where the headquarters are located in your answer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT City, Province FROM organization WHERE Name = 'European Bank for Reconstruction and Development'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT City, Province FROM organization WHERE Name = 'European Bank for Reconstruction and Development'", "index": 3975, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['European', 'Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIn which city is the European Bank for Reconstruction and Development's headquarters? Please include the city and province where the headquarters are located in your answer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['WHO', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['WHO', 'ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNation and country share the same meaning. Proportion refers to percentage\nWhich nation has the lowest proportion of people who speak an African language? Please state the nation's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'African' ORDER BY T2.Percentage ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'African' ORDER BY T2.Percentage ASC LIMIT 1", "index": 3976, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLatitude real, -- example: [46.55, -2.5]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['African', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['WHO', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['WHO', 'ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNation and country share the same meaning. Proportion refers to percentage\nWhich nation has the lowest proportion of people who speak an African language? Please state the nation's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Christian', 'English', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['Roman Catholic', 'Christian', 'Anglican', 'African Methodist Episcopal']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Christian', 'Target']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['English', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has three different religions-Anglicanism, Christianity, and Roman Catholicism and uses 100% 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.Country FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country INNER JOIN language AS T3 ON T3.Country = T2.Country WHERE (T2.Name = 'Anglican' OR T2.Name = 'Christian' OR T2.Name = 'Roman Catholic') AND T3.Name = 'English' AND T3.Percentage = 100 GROUP BY T1.Name HAVING COUNT(T1.Name) = 3", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Country FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country INNER JOIN language AS T3 ON T3.Country = T2.Country WHERE (T2.Name = 'Anglican' OR T2.Name = 'Christian' OR T2.Name = 'Roman Catholic') AND T3.Name = 'English' AND T3.Percentage = 100 GROUP BY T1.Name HAVING COUNT(T1.Name) = 3", "index": 3977, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Christian', 'English', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n River text, -- example: ['River']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['Roman Catholic', 'Christian', 'Anglican', 'African Methodist Episcopal']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Christian', 'Target']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['English', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has three different religions-Anglicanism, Christianity, and Roman Catholicism and uses 100% 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 mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEconomies refers to countries\nWhich of the top 3 economies by GDP has the lowest proportion of the economy devoted to agriculture?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC, T2.Agriculture ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC, T2.Agriculture ASC LIMIT 1", "index": 3978, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEconomies refers to countries\nWhich of the top 3 economies by GDP has the lowest proportion of the economy devoted to agriculture?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['United States', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOrganization refers to corporation\nWhich United States province is home to the greatest number of corporations' corporate headquarters?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Province FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'United States' GROUP BY T1.Province ORDER BY COUNT(T1.Name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Province FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'United States' GROUP BY T1.Province ORDER BY COUNT(T1.Name) DESC LIMIT 1", "index": 3979, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Province', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['United States', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Province', 'Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE islandIn (\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOrganization refers to corporation\nWhich United States province is home to the greatest number of corporations' corporate headquarters?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLarger date of indepedence refers to more recent indepdence; Nation refers to country\nWhat are the most recent three independent nations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country ORDER BY T2.Independence DESC LIMIT 3", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country ORDER BY T2.Independence DESC LIMIT 3", "index": 3980, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLarger date of indepedence refers to more recent indepdence; Nation refers to country\nWhat are the most recent three independent nations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['republic', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNation refers to country\nPlease name any three sovereign nations that have been governed by the republic since 1991.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT country FROM politics WHERE government = 'republic' AND STRFTIME('%Y', independence) >= '1991' AND country IN ( SELECT country FROM country ) ORDER BY independence LIMIT 3", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT country FROM politics WHERE government = 'republic' AND STRFTIME('%Y', independence) >= '1991' AND country IN ( SELECT country FROM country ) ORDER BY independence LIMIT 3", "index": 3981, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['republic', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNation refers to country\nPlease name any three sovereign nations that have been governed by the republic since 1991.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['associated', 'member', 'Category I', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich company falls under the category of an associated member? Please provide the organization's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT NAME FROM organization WHERE country IN ( SELECT country FROM politics WHERE dependent != '' )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT NAME FROM organization WHERE country IN ( SELECT country FROM politics WHERE dependent != '' )", "index": 3982, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['associated', 'member', 'Category I', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich company falls under the category of an associated member? Please provide the organization's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich desert in Kazakhstan is the largest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Kazakstan' ORDER BY T1.Area DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Kazakstan' ORDER BY T1.Area DESC LIMIT 1", "index": 3983, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Mountains text, -- example: ['Alps', 'East African Rift']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich desert in Kazakhstan is the largest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['constitutional monarchy', 'monarchy', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNation refers to country; Information of growth appears in the column Established\nWhich constitutional monarchy nations saw the greatest growth in the number of organizations after 1907?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE STRFTIME('%Y', T2.Established) > '1907' AND T3.Government = 'constitutional monarchy' GROUP BY T1.Name ORDER BY COUNT(DISTINCT T2.Name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE STRFTIME('%Y', T2.Established) > '1907' AND T3.Government = 'constitutional monarchy' GROUP BY T1.Name ORDER BY COUNT(DISTINCT T2.Name) DESC LIMIT 1", "index": 3984, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['constitutional monarchy', 'monarchy', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNation refers to country; Information of growth appears in the column Established\nWhich constitutional monarchy nations saw the greatest growth in the number of organizations after 1907?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['parliamentary democracy', 'parliamentary', 'democracy', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage of rivers with lengths greater than 3,000 miles = [(Total number of rivers with lengths greater than 3,000 miles) / (Total number of rivers)] * 100%\nWhat percentage of nations have achieved independence since 1993 and practice parliamentary democracy? Please include any three parliament-based democracies that attained independence after 1993.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(government = 'parliamentary democracy', 1, 0)) , CAST(SUM(IIF(government = 'parliamentary democracy', 1, 0)) AS REAL) * 100 / COUNT(*) FROM politics AS t1 WHERE STRFTIME('%Y', independence) >= '1993'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT SUM(IIF(government = 'parliamentary democracy', 1, 0)) , CAST(SUM(IIF(government = 'parliamentary democracy', 1, 0)) AS REAL) * 100 / COUNT(*) FROM politics AS t1 WHERE STRFTIME('%Y', independence) >= '1993'", "index": 3985, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['parliamentary democracy', 'parliamentary', 'democracy', 'Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Independence', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPercentage of rivers with lengths greater than 3,000 miles = [(Total number of rivers with lengths greater than 3,000 miles) / (Total number of rivers)] * 100%\nWhat percentage of nations have achieved independence since 1993 and practice parliamentary democracy? Please include any three parliament-based democracies that attained independence after 1993.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Russian', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Russian', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProportion of rivers with lengths greater than 3,000 miles = [(Total number of rivers with lengths greater than 3,000 miles) / (Total number of rivers)] * 100%\nWhat proportion of rivers have a length of more than 3,000 miles? Please provide the name of a Russian river that is more than 3,000 miles long.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T1.Length > 3000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Name) FROM river AS T1 INNER JOIN located AS T2 ON T1.Name = T2.River INNER JOIN country AS T3 ON T3.Code = T2.Country", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.Length > 3000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Name) FROM river AS T1 INNER JOIN located AS T2 ON T1.Name = T2.River INNER JOIN country AS T3 ON T3.Code = T2.Country", "index": 3986, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Russian', 'Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Service real, -- example: [34.0, 15.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Russian', 'Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProportion of rivers with lengths greater than 3,000 miles = [(Total number of rivers with lengths greater than 3,000 miles) / (Total number of rivers)] * 100%\nWhat proportion of rivers have a length of more than 3,000 miles? Please provide the name of a Russian river that is more than 3,000 miles long.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['London', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['London', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['London', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['London', 'City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['London', 'City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLondon is a city\nProvide a list of all organisations with headquarters in London?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name FROM organization WHERE City = 'London'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name FROM organization WHERE City = 'London'", "index": 3987, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['London', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n River text, -- example: ['River', 'Donau']\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['London', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['London', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['London', 'City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['London', 'City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLondon is a city\nProvide a list of all organisations with headquarters in London?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['USA', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['USA', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['USA', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['USA', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['USA', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['USA', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['USA', 'Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['USA', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['USA', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['USA', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor each organisations with headquarters in the USA, provide the its full name and the city where the headquarter is located at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name, City FROM organization WHERE Country = 'USA'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name, City FROM organization WHERE Country = 'USA'", "index": 3988, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['USA', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['USA', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['USA', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['USA', 'CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['USA', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n River text, -- example: ['River']\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['USA', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['USA', 'Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['USA', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['USA', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['USA', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor each organisations with headquarters in the USA, provide the its full name and the city where the headquarter is located at.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Paris', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Paris', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Paris', 'Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['Abbreviation', 'ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['Paris', 'City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nParis is a city\nName the first organisation established in the Paris city. State its abbreviation, full name and date of establishment.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Abbreviation, Name, Established FROM organization WHERE City = 'Paris' ORDER BY Established ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Abbreviation, Name, Established FROM organization WHERE City = 'Paris' ORDER BY Established ASC LIMIT 1", "index": 3989, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Paris', 'Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['City', 'Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['Paris', 'City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Paris', 'Aachen', 'Aalborg']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['Abbreviation', 'ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['Paris', 'City', 'Khartoum']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nParis is a city\nName the first organisation established in the Paris city. State its abbreviation, full name and date of establishment.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich 2 countries' border span across the longest length? Provide the country's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name, T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 ORDER BY T2.Length DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 ORDER BY T2.Length DESC LIMIT 1", "index": 3990, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Borders', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich 2 countries' border span across the longest length? Provide the country's full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Bulgaria', 'Borders', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Bulgaria', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Bulgaria', 'Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Bulgaria', 'Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Bulgaria', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBulgaria is a country name\nName all countries in which have border with Bulgaria.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T1.Name = 'Bulgaria'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T3.Name FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T1.Name = 'Bulgaria'", "index": 3991, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Borders', 'Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Bulgaria', 'Borders', 'Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Bulgaria', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Bulgaria', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['Bulgaria', 'Borders', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Bulgaria', 'Borders', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Bulgaria', 'AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nBulgaria is a country name\nName all countries in which have border with Bulgaria.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'IOC', 'AG', 'ANC']\n Type text, -- example: ['member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['IOC', 'ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the country member of 'IOC' organization, which country has the most 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 T2.Name FROM isMember AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Organization = 'IOC' ORDER BY T2.Population DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Name FROM isMember AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Organization = 'IOC' ORDER BY T2.Population DESC LIMIT 1", "index": 3992, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'IOC', 'AG', 'ANC']\n Type text, -- example: ['member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['IOC', 'ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAmong the country member of 'IOC' organization, which country has the most 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 ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Islamic Development Bank', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all members and member type of the Islamic Development Bank.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Country, T2.Type FROM organization AS T1 INNER JOIN isMember AS T2 ON T1.Abbreviation = T2.Organization INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T1.Name = 'Islamic Development Bank'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Country, T2.Type FROM organization AS T1 INNER JOIN isMember AS T2 ON T1.Abbreviation = T2.Organization INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T1.Name = 'Islamic Development Bank'", "index": 3993, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\n Type text, -- example: ['member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Islamic Development Bank', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all members and member type of the Islamic Development Bank.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Asia Pacific Economic Cooperation', 'Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia Pacific Economic Cooperation is an organization name\nState the area and population of the country where Asia Pacific Economic Cooperation headquarter is located.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Name, T2.Population FROM organization AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'Asia Pacific Economic Cooperation'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Name, T2.Population FROM organization AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'Asia Pacific Economic Cooperation'", "index": 3994, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Asia Pacific Economic Cooperation', 'Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Type text,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Asia', 'Europe']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Asia', 'Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAsia Pacific Economic Cooperation is an organization name\nState the area and population of the country where Asia Pacific Economic Cooperation headquarter is located.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['National Society', 'member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\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 organization(s) that has 'National Society' as member type.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM organization AS T1 INNER JOIN isMember AS T2 ON T2.Country = T1.Country INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T2.Type = 'National Society'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM organization AS T1 INNER JOIN isMember AS T2 ON T2.Country = T1.Country INNER JOIN country AS T3 ON T2.Country = T3.Code WHERE T2.Type = 'National Society'", "index": 3995, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Type text, -- example: ['volcanic', 'lime']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['National Society', 'member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\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 organization(s) that has 'National Society' as member type.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the least organization membership?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT country FROM organization WHERE country IN ( SELECT Code FROM country ) GROUP BY country ORDER BY COUNT(NAME) LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT country FROM organization WHERE country IN ( SELECT Code FROM country ) GROUP BY country ORDER BY COUNT(NAME) LIMIT 1", "index": 3996, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n GDP real, -- gross domestic product, example: [152000.0, 12800.0]\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich country has the least organization membership?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'IFAD', 'AG', 'ANC']\n Type text, -- example: ['Category III', 'Category II', 'Category I', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['IFAD', 'ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all countries with 'Category III' membership in 'IFAD' organization. Please also provide the capital of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name, Capital FROM country WHERE Code IN ( SELECT Country FROM isMember WHERE type = 'Category III' AND Organization = 'IFAD' )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name, Capital FROM country WHERE Code IN ( SELECT Country FROM isMember WHERE type = 'Category III' AND Organization = 'IFAD' )", "index": 3997, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'IFAD', 'AG', 'ANC']\n Type text, -- example: ['Category III', 'Category II', 'Category I', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceLongitude real, -- example: [8.2, 10.3]\n SourceLatitude real, -- example: [46.55, -2.5]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n EstuaryLatitude real, -- example: [47.61, 45.13]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['IFAD', 'ABEDA', 'ACC']\n Name text, -- example: ['ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all countries with 'Category III' membership in 'IFAD' organization. Please also provide the capital of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the organizations with the most members.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.Name FROM organization AS T1 INNER JOIN isMember AS T2 ON T2.Country = T1.Country INNER JOIN country AS T3 ON T2.Country = T3.Code GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM organization AS T1 INNER JOIN isMember AS T2 ON T2.Country = T1.Country INNER JOIN country AS T3 ON T2.Country = T3.Code GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1", "index": 3998, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.0]\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Population integer, -- example: [247113, 113865]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n Inflation real, -- example: [2.3, 3.5]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n River text, -- example: ['Ammer', 'Yukon River']\n Longitude real, -- example: [11.6, 12.1]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Area real, -- example: [650.0, 5.2]\n Height real, -- example: [675.0, 1225.0]\n Longitude real, -- example: [20.0, 14.4]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n Depth real, -- example: [3113.0, 5203.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Vienna', 'Afghanistan']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Dependent text, -- example: ['Depe', 'USA']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n Population_Growth real, -- example: [0.41, 4.78]\n Infant_Mortality real, -- example: [6.2, 149.7]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n Percentage real, -- example: [1.8, 4.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n Type text, -- example: ['member', 'Type', 'nonregional member']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'al Khartum']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n Length real, -- example: [288.0, 313.0]\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Height real,\n Type text,\n Longitude real,\n Latitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n Percentage real, -- example: [11.0, 26.1]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['A', 'AFG']\n Country2 text, -- example: ['CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nName the organizations with the most members.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Australia', 'Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\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 capital of Australia? Is the capital a headquarter to any organization? Name the organization(s).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Capital, T1.Name FROM organization AS T1 INNER JOIN country AS T2 ON T1.City = T2.Capital WHERE T2.Name = 'Australia'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Capital, T1.Name FROM organization AS T1 INNER JOIN country AS T2 ON T1.City = T2.Capital WHERE T2.Name = 'Australia'", "index": 3999, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE mergesWith (\n Sea1 text, -- example: ['Andaman Sea', 'Arabian Sea']\n Sea2 text, -- example: ['Sea2', 'Gulf of Bengal']\n PRIMARY KEY (Sea1, Sea2)\n);\n\nCREATE TABLE located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\n Lake text, -- example: ['Lake', 'Lake Skutari']\n);\n\nCREATE TABLE sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE borders (\n Country1 text, -- example: ['S', 'A', 'AFG']\n Country2 text, -- example: ['S', 'CH', 'CZ']\n Length real, -- example: [164.0, 362.0]\n PRIMARY KEY (Country1, Country2)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Depth real, -- example: [81.1, 5.6]\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\n Longitude real, -- example: [11.6, 12.1]\n Latitude real, -- example: [48.0, 56.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['Coun', 'UAE']\n Province text, -- example: ['Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, Country, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Australia', 'Afghanistan', 'Albania']\n Code text, -- example: ['S', 'A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Area real, -- example: [83850.0, 647500.0]\n Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\n);\n\nCREATE TABLE geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', 'AG', 'ANC']\n PRIMARY KEY (Country, Organization)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n Latitude real, -- example: [57.0, 56.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\n River text, -- example: ['Rhein', 'Po']\n Sea text, -- example: ['Atlantic Ocean', 'Sea of Okhotsk']\n SourceLongitude real, -- example: [8.2, 10.3]\n Mountains text, -- example: ['Alps', 'East African Rift']\n SourceAltitude real, -- example: [2310.0, 2235.0]\n EstuaryLongitude real, -- example: [8.22, 9.88]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['S', 'Coun', 'CAM']\n Province text, -- example: ['Adamaoua', 'Alajuela']\n PRIMARY KEY (Lake, Country, Province)\n);\n\nCREATE TABLE mountainOnIsland (\n Mountain text, -- example: ['Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Island', 'Madagaskar']\n PRIMARY KEY (Mountain, Island)\n);\n\nCREATE TABLE geo_source (\n River text, -- example: ['River', 'White Nile']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Aali an Nil', 'Afghanistan']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\n PRIMARY KEY (Country, Continent)\n);\n\nCREATE TABLE population (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE locatedOn (\n City text, -- example: ['Aberdeen', 'Aberystwyth']\n Province text, -- example: ['Province', 'Grampian']\n Country text, -- example: ['Coun', 'GB']\n Island text, -- example: ['Island', 'Great Britain']\n PRIMARY KEY (City, Province, Country, Island)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n Height real,\n Type text,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE politics (\n Country text, -- example: ['A', 'AFG']\n Independence date, -- example: ['Independence', '1918-11-12']\n Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n Population integer, -- example: [1599605, 110700]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\n CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n River text, -- example: ['River']\n);\n\nCREATE TABLE island (\n Name text, -- example: ['Aland', 'Alicudi']\n Islands text, -- example: ['Aland Islands', 'Lipari Islands']\n Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n Name text, -- example: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE geo_estuary (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['S', 'Coun', 'SUD']\n Province text, -- example: ['AG', 'Aali an Nil']\n PRIMARY KEY (River, Country, Province)\n);\n\nCREATE TABLE geo_island (\n Island text, -- example: ['Aland', 'Alicudi']\n Country text, -- example: ['Alan', 'Lipa']\n Province text, -- example: ['101', '102']\n PRIMARY KEY (Island, Country, Province)\n);\n\nCREATE TABLE `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\n Percentage real, -- example: [50.0, 60.0]\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n Target text, -- example: ['Target', 'Christian']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Longitude real, -- example: [26.0, -69.25]\n Latitude real, -- example: [33.0, -24.5]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n Agriculture real, -- example: [2.0, 65.0]\n Service real, -- example: [34.0, 15.0]\n Industry real, -- example: [64.0, 20.0]\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE ethnicGroup (\n Country text, -- example: ['S', 'GE', 'EAU']\n Name text, -- example: ['Abkhaz', 'Acholi']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\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 capital of Australia? Is the capital a headquarter to any organization? Name the organization(s).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }